Scope
- Use Case:
- Consider the situation where:
- A job chain is to start at a number of parallel job chains
- Subsequent jobs in started job chains check if jobs from parallel chains completed successfully.
- Usually a split & sync pattern is used for similar use cases, however, synchronizing includes that both jobs have to be completed.
- Instead the current use case is about check and control if a job of a parallel chain has completed without forcing both jobs to run synchronously.
- Consider the situation where:
Solution
- Download: final_chain_job_chain_history.zip
- Extract the archive to a folder in your JobScheduler installation named
./config/live
. - The archive will extract the files to a sub-folder
parallel_job_chain_control.
- Note that you can store the sample files in any folder you like.
Pattern
Implementation
Components
- The solution contains six job chains:
JobChain1
runsJob1
andJob2
in parallel.- On successful completion of
Job1
thenJobChain2
is run - On successful completion of
Job2
thenJobChain3
is run
- On successful completion of
JobChain2
runsJob3
andJob4
JobChain3
runsJob5
andJob6
JobChain4
runs after successful completion ofJobChain1
JobChain4
runsJob7
,Job8
,Job9
Job7
runs 1stJob8
runs onceJob7
andJob4
have run successfully
JobChain5
runs after successful completion ofJobChain1
JobChain5
runsJob10
,Job11
andJob12
Job10
runs 1stJob11
runs onceJob10
,Job4
andJob6
have run successfullyJob12
runs onceJob11
has completed successfully
JobChain6
runs onceJob9
andJob12
have completed successfully
Usage
- The first job split1 set some pairs parameters to control the dependencies.
- The first parameter of the pair is a flag which is used to check if the dependent jobs are successfully completed.
- The value of this parameter is initialised with "0" and will be modified by the dependent jobs with "1".
- In above example these are
job4_successfully_completed=0 ; will be checked by Job8 and Job11 job6_successfully_completed=0 ; will be checked by Job11 job12_successfully_completed=0 ; will be checked by Job13
- The second parameter of the pair describes which job commits which job chains that it has successfully completed.
- You need to specify all job chains, in which the order can be located with respect to the checking jobs
- The job chains can specify relative to the current job chain (here Job Chain 1)
- In above example these are
job4_commits_finish_to="/2016060710000017/Chain1;Chain4;Chain5"
- The first parameter of the pair is a flag which is used to check if the dependent jobs are successfully completed.
- Positive Check
- Add an order to
job_chain_A
using JOC'sAdd Order
context menu.- The order should pass through the job chain without errors.
- Add an order to
job_chain_B
using JOC'sAdd Order
context menu.- The order should also pass through the job chain without errors.
- Add an order to
job_chain_Z
using JOC'sAdd Order
context menu.- The order should pass through the job chain without errors as all pre-conditions are met.
- Add an order to
- Negative Check
- Modify the job
do_something_job_chain_A
to include an error, e.g. by adding the commandexit 1
as the final line in the job script. - Add an order to
job_chain_A
:- The order should proceed with an error.
- Add an order to
job_chain_Z
- The order should proceed with an error that is visible in the order log. This error will state that the predecessor job did not complete successfully.
- The order will be set back and will be repeated according to the setback intervals that have been specified for the job
check_predecessor_job_chain_Z
.
- Removing the modification to job
do_something_job_chain_A
and adding an order tojob_chain_A
that then runs successfully should result in a successful run ofjob_chain_Z
- either by a new order added tojob_chain_Z
or by the next execution of the previous order that has been set back.
- Modify the job
See also
- How to check the job chain history for previous job chain and order runs
- How to add a condition to check previous jobs before the execution of the current job chain