Starting Task Execution

Below is the example of using the SetScheduler operation to start container's tasks execution. The request contains the scheduled tasks container moniker and the pattern indicating whether tasks must be started. The list of tasks to be started is also sent. The response contains execution results.

SOAP request:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SetScheduler xmlns="http://www.fsight.ru/PP.SOM.Som">
<tScheduler xmlns="">
  <id>S1!M!6445</id>
  </tScheduler>
<tArg xmlns="">
<pattern>
  <obInst>true</obInst>
  <execTasks>true</execTasks>
  </pattern>
<meta>
<tasks>
<its>
<it>
  <k>6449</k>
  <id>RUN_MODULE</id>
  <n>Unit execution</n>
  <vis>true</vis>
  <type>ExecuteSub</type>
  <ds />
<properties>
<period>
  <type>Daily</type>
  <startDateTime>1999-12-31T23:00:00</startDateTime>
  <stopDateTime>2009-12-31T23:00:00</stopDateTime>
  <everyDays>1</everyDays>
  </period>
  <active>false</active>
  <queueing>false</queueing>
  <userTag>ADMIN</userTag>
  <threadClass>1</threadClass>
<publishing>
  <SendMail>false</SendMail>
  <mailAddress />
  <mailSubject>&[TASK_RESULT] - &[TASK_FINISH] : &[TASK_NAME]</mailSubject>
  <mailBody>&[TASK_RESULT] - &[TASK_FINISH] : &[TASK_NAME]</mailBody>
  <ftpAddress />
  <appendAttachment>true</appendAttachment>
  <dynamicMailListMacro />
  <dynamicMailListModule />
  <UseDynamicMailList>false</UseDynamicMailList>
  </publishing>
  <paramValues />
  <eventId />
  </properties>
<settings>
<fore>
<obDesc isShortcut="false" isLink="false" ds="" ver="0" hf="false">
  <i>TASK_MODULE</i>
  <n>Unit</n>
  <k>6447</k>
  <c>1537</c>
  <p>6444</p>
  <h>false</h>
  <hasPrv>false</hasPrv>
  <ic>false</ic>
  <trackElementDependents>false</trackElementDependents>
  </obDesc>
  <subName>Run</subName>
  </fore>
  </settings>
  </it>
  </its>
  </tasks>
  </meta>
<metaGet>
  <obInst>true</obInst>
  <tasks>Get</tasks>
<task>
  <result>true</result>
  </task>
  </metaGet>
  </tArg>
  </SetScheduler>
  </s:Body>
  </s:Envelope>

SOAP response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<SetSchedulerResult xmlns="http://www.fsight.ru/PP.SOM.Som" xmlns:q1="http://www.fsight.ru/PP.SOM.Som" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<id xmlns="">
  <id>S1!M!6445</id>
  </id>
<execResults xmlns="">
<its>
<it>
  <k>6449</k>
  <id>RUN_MODULE</id>
  <startDate>2020-11-12T14:50:51.000</startDate>
  <finishDate>2020-11-12T14:50:52.000</finishDate>
  <state>Succeeded</state>
  <messages />
  </it>
  </its>
  </execResults>
<meta xmlns="">
<obInst>
<obDesc ds="" isShortcut="0" isLink="0" ver="0" hf="0">
  <i>TASKS_CONTAINTER</i>
  <n>Scheduled tasks container</n>
  <k>6445</k>
  <c>5378</c>
  <p>6444</p>
  <h>0</h>
  <hasPrv>0</hasPrv>
  <ic>0</ic>
  <trackElementDependents>0</trackElementDependents>
  <isPermanent>1</isPermanent>
  <isTemp>0</isTemp>
  </obDesc>
  </obInst>
<tasks>
<its>
<it>
  <k>6449</k>
  <id>RUN_MODULE</id>
  <n>Unit execution</n>
  <vis>1</vis>
  <type>ExecuteSub</type>
  <ds />
<result>
  <k>6449</k>
  <id>RUN_MODULE</id>
  <startDate>2020-11-12T14:50:51.000</startDate>
  <finishDate>2020-11-12T14:50:52.000</finishDate>
  <state>Succeeded</state>
  <messages />
  </result>
  </it>
  </its>
  </tasks>
  </meta>
  </SetSchedulerResult>
  </soapenv:Body>
  </soapenv:Envelope>

JSON request:

{
"SetScheduler" :
{
"tScheduler" :
{
"id" : "S1!M!6445"
},
"tArg" :
{
"pattern" :
{
"obInst" : "true",
"execTasks" : "true"
},
"meta" :
{
"tasks" :
{
"its" :
{
"it" :
[
{
"k" : "6449",
"id" : "RUN_MODULE",
"n" : "Unit execution",
"vis" : "true",
"type" : "ExecuteSub",
"ds" : "",
"properties" :
{
"period" :
{
"type" : "Daily",
"startDateTime" : "1999-12-31T23:00:00",
"stopDateTime" : "2009-12-31T23:00:00",
"everyDays" : "1"
},
"active" : "false",
"queueing" : "false",
"userTag" : "ADMIN",
"threadClass" : "1",
"publishing" :
{
"SendMail" : "false",
"mailAddress" : "",
"mailSubject" : "&[TASK_RESULT] - &[TASK_FINISH] : &[TASK_NAME]",
"mailBody" : "&[TASK_RESULT] - &[TASK_FINISH] : &[TASK_NAME]",
"ftpAddress" : "",
"appendAttachment" : "true",
"dynamicMailListMacro" : "",
"dynamicMailListModule" : "",
"UseDynamicMailList" : "false"
},
"paramValues" : "",
"eventId" : ""
},
"settings" :
{
"fore" :
{
"obDesc" :
{
"@ds" : "",
"@isShortcut" : "false",
"@isLink" : "false",
"@ver" : "0",
"@hf" : "false",
"i" : "TASK_MODULE",
"n" : "Unit",
"k" : "6447",
"c" : "1537",
"p" : "6444",
"h" : "false",
"hasPrv" : "false",
"ic" : "false",
"trackElementDependents" : "false"
},
"subName" : "Run"
}
}
}
]
}
}
},
"metaGet" :
{
"obInst" : "true",
"tasks" : "Get",
"task" :
{
"result" : "true"
}
}
}
}
}

JSON response:

{
"SetSchedulerResult" :
{
"id" :
{
"id" : "S1!M!6445"
},
"execResults" :
{
"its" :
{
"it" :
[
{
"k" : "6449",
"id" : "RUN_MODULE",
"startDate" : "2020-11-12T14:50:51.000",
"finishDate" : "2020-11-12T14:50:52.000",
"state" : "Succeeded",
"messages" : ""
}
]
}
},
"meta" :
{
"obInst" :
{
"obDesc" :
{
"@ds" : "",
"@isShortcut" : "0",
"@isLink" : "0",
"@ver" : "0",
"@hf" : "0",
"i" : "TASKS_CONTAINTER",
"n" : "Scheduled tasks container",
"k" : "6445",
"c" : "5378",
"p" : "6444",
"h" : "0",
"hasPrv" : "0",
"ic" : "0",
"trackElementDependents" : "0",
"isPermanent" : "1",
"isTemp" : "0"
}
},
"tasks" :
{
"its" :
{
"it" :
[
{
"k" : "6449",
"id" : "RUN_MODULE",
"n" : "Unit execution",
"vis" : "1",
"type" : "ExecuteSub",
"ds" : "",
"result" :
{
"k" : "6449",
"id" : "RUN_MODULE",
"startDate" : "2020-11-12T14:50:51.000",
"finishDate" : "2020-11-12T14:50:52.000",
"state" : "Succeeded",
"messages" : ""
}
}
]
}
}
}
}
}
public static SetSchedulerResult ExecuteTasks(SchedulerId moniker, SchedulerTasks tasks)
{
var somClient = new SomPortTypeClient(); // Proxy object for operation execution
//Operation execution parameters
var tSet = new SetScheduler()
{
tScheduler = moniker,
tArg = new SetSchedulerArg()
{
pattern = new SchedulerMdPattern // Metadata get pattern
{
execTasks = true,
},
meta = new SchedulerMd()
{
tasks = tasks
},
metaGet = new SchedulerMdPattern()
{
tasks = ListOperation.Get,
task = new SchedulerTaskPattern()
{
result = true
}
}
}
};
//Execute tasks
var tResult = somClient.SetScheduler(tSet);
return tResult;
}

See also:

SetScheduler