Page 1 of 1

check job status in routine without waiting for completion

Posted: Thu May 26, 2016 1:31 am
by wuruima
Hi all.

In a routine, I use a for loop to trigger parallel jobs. I would like these jobs to run in parallel instead of in sequentially.

But how can I detect the status of the jobs at the end of the routine?

I need to make sure the parallel jobs completed successfully and then finish the routine processing.

Re: check job status

Posted: Thu May 26, 2016 2:00 am
by wuruima
I don't want to run DSWaitForJob every time. the jobs could run at the same time.

Posted: Thu May 26, 2016 6:24 am
by chulett
Set up (or find) a Sequence job with multiple unconnected Job Activity stages. No need to actually run it but rather examine the job control code that it generates. From what I recall, you should be able to find the code where it starts all of the jobs and then issues a single DSWaitForJob function call with a list of all of the PIDs running to wait for.

Meaning it is possible and the code for it is out there... or can be.

Posted: Thu May 26, 2016 8:48 am
by UCDI
would a sequencer work, where you fed all the jobs that start at once into a single sequencer and checked after that to see if you can proceed?

I have not done this, its just an idea to try.

Posted: Thu May 26, 2016 8:54 am
by chulett
Nope, at least not via a Job Activity stage which automatically does a "wait" making them run in a serial manner. At least that's what I recall. It would provide a gate, however, and not proceed until all are complete (assuming it is set that way) but won't affect parallel versus serial in the running of the jobs coming into it.

Posted: Thu May 26, 2016 1:45 pm
by Teej
Plus there are a number of settings that limit the actual number of jobs being kicked off by the Job Sequencer. I do not have a reference handy to help guide you just yet, but this is tunable.

Have you considered using Workload Manager to help manage your resources (available in 9.1+), while throwing out as many jobs as you can?

-T.J.

Posted: Thu May 26, 2016 5:33 pm
by ray.wurlod
DSWaitForJob() can wait for multiple jobs.

Review the job control code generated by a sequence job to see how (essentially a dynamic array of job handles).

Posted: Thu May 26, 2016 5:42 pm
by chulett
As noted earlier. :wink:

Posted: Thu May 26, 2016 8:24 pm
by wuruima
very useful. Thanks all.

Posted: Fri May 27, 2016 9:42 am
by UCDI
"It would provide a gate, however, and not proceed until all are complete"

Right, this is what I was thinking -- for simple needs, it would be sufficient, if all you need is "wait for 1-5 before kicking off 6".

Posted: Fri May 27, 2016 10:14 am
by chulett
Yes, true... that is exactly what they are for.