CPS Job Inter-dependancies

Jan 18, 2017 at 05:00 AM|60 Views

Hello,

I am trialling BPA Version 9.0.19.0

I have a requirement to submit a job (Job A), and then have another job (Job B) monitoring the progress of the first job (Job A). The requirement is for Job B to check the progress of Job A every 15 minutes.

There is no problem starting both jobs at the same time - I have created a chain with a step that contains both jobs.

There is no problem with Job B running in a loop - I have a step calling the System_Sleep process, and then another step to check the progress of Job A, and the Status Handler of this step is to "Restart Chain", so it will enter a loop.

But I need a way for Job B to determine when Job A is finished, otherwise it will run indefinitely, and I need some assistance or advice.

I have thought of Job A raising an event when it is completed, but I can't find a way of checking for status of this event from within Job B at runtime.

I then thought perhaps if I could set a boolean parameter value that is shared between the two jobs, so that when Job A is finished, it could change the value of the parameter, and then Job B could use this as a pre-condition.

I defined a boolean "in/Out" parameter "IsJobRunning" at the top chain level (default value = "true"), and I have this mapped to another In/Out parameter in Job A - which is being set to "false" at the end of processing the steps in Job A.

I then had the same parameter mapped into Job B and used as a precondition for the steps there - (REL expression "=chainParameters.IsJobRunning"). I had hoped that when Job A updated the mapped parameter, it would also update the parameter at the top chain level and this would then be passed via the parameter mappings into Job B.

Unfortunately, is seems the updated parameter value is not passed back up to the top chain level - even though all parameters are defined as "In/Out". And so the updated value of the parameter is not recognised by Job B, and so it runs in an infinite loop even though Job A has finished.

If anyone has any ideas or suggestions for a solution it would be greatly appreciated!

Add comment

Job A is running a large update job, and the business want to get regular updates of the progress of the job via email. So they want Job B to be running in parallel, sending a percentage completion every 15 minutes.

With both jobs defined inside a parent chain, It's easy to start them both at the same time, but there needs to be some sort of flag or event that Job B can check to know that Job A has completed, otherwise it will just keep on going and going.

I've tried defining a event that is raised by Job A on completion, but there does not seem to be a way to get Job B to detect this... but maybe there is something possible using REL code.

I had hoped a boolean chain in/out parameter could be updated by Job A and that Job B could use it as a pre-condition. But this did not work.

The only other thing I can think of is to define a custom table in BPA and see if Job A can update a flag in it, and then have Job B check this.