From an element, we are executing Automation scripts for certain background tasks. These scripts are executed from a QAction.
A table shows an overview of all tasks and their status (ongoing, scheduled, failed,...). There is currently a timeout configured that updates the record in the table to "Timeout" in case the configured timeout time was surpassed. These tasks are queued so there is only 1 instance of the script running at the same time.
I would like to extend this by verifying from the QAction periodically if the script is actually still running (and didn't for example crash for any reason). This would avoid having to wait unnecessarily for the timeout time.
How can this be done exactly?
Hi Joey,
You can also do this from a QAction, Automation script, or any C# application with the following code:
private bool IsAutomationScriptRunning(string scriptName)
{
var request = new SetAutomationInfoMessage(AutomationInfoType.Maintenance /* 31 */) {
Sa = new SA(new string[] { "LIST_SCRIPTIDS" })
};var response = connection.SendSingleResponseMessage<SetAutomationInfoResponseMessage>(request);
if(response is null || response.saRet?.Sa?.Length == 0) {
return false;
}// Example: 565;2021-05-07 10:08:50;<scriptname>;Administrator;Running
return response.saRet.Sa.Any(line => line.ContainsInvariant($";{scriptName};") && line.ContainsInvariant(";Running"));
}
Hi Joey,
Maybe you can have a look at the Skyline Automation Performance Monitor connector.
This protocol tracks which scripts are running, how often they ran and how long the scripts have been running.
Thanks Ive! I can confirm this is using the same code as Jens has described.