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.
{
"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"
}
}
}
}
}
{
"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: