Page 1 of 1

Status from sub task?

Posted: Tue Jun 28, 2016 9:26 am
by userXXX
Hello,
if one "master task" starts a "sub task" and the the "sub task" gets an error, how can I get information about that in the "master task"?

Our case:
In my example the "master task" starts 4 "sub tasks" parallel which have to collect several data into some database tables. After that, "master task" triggers a reporting tool to create a report. In case that one of the "sub task" fails, the report is still being created, but without showing all necessary data.

Would can I do to stop the "master task" from continuing after the fail of one of its "sub tasks"?

Thank you.

Re: Status from sub task?

Posted: Tue Jun 28, 2016 9:45 am
by Oleg
You can do this via global variables.
Look at this algorithm:

Master task starts slave task with waiting.

first step of slave task is
status = running

The last step
status = OK

So, master task starts slave task. When slave task is finished you can read the variable status.
If status contains running then this means that the task has been aborted on error

If you use several slave tasks use different global variables: status1, status2 and so on.

Re: Status from sub task?

Posted: Wed Jun 29, 2016 11:25 am
by userXXX
OK, I understand.

Could be necessary to maintain a huge number of global variables one day.
But as an alternative it's possible to write status information in local files or a database table.

Re: Status from sub task?

Posted: Thu Jun 30, 2016 11:48 am
by Oleg
Of course you can use external file or database by your own algorithm.