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 of parameters in a pre-processing to control which job tells that it is successfully completed.- The first parameter of the pair is a flag which is used for a later 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
which will be checked byJob8
andJob11
job6_successfully_completed=0
which will be checked byJob11
job12_successfully_completed=0
which will be checked byJob13
- 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 current job chain (here
JobChain1
) is always the first in the list. - The job chains can specify with its absolute path or relative to the current job chain.
In above example these are
job4_commits_completion_to="/parallelExecutionExample/JobChain1;JobChain4;JobChain5"
job6_commits_completion_to="/parallelExecutionExample/JobChain1;JobChain5"
job12_commits_completion_to="/parallelExecutionExample/JobChain1;JobChain4;JobChain6"
- The first parameter of the pair is a flag which is used for a later check if the dependent jobs are successfully completed.
- The dependent jobs (here
Job4
,
andJob6
) have a post-processing where they resume the ordersJob12
- in all job chains which are specified in the "
commits_completion_to
" parameter - where the value of the "
successfully_completed
" parameter is set to "1"
- in all job chains which are specified in the "
- The jobs which wait of its dependent jobs have a pre-processing where they check the corresponding "
successfully_completed
" parameters- These jobs have a task parameter "
dependent_jobs
" where a list of its dependent jobs are specified. - In above example these are
Job8 : dependent_jobs="Job4"
Job11: dependent_jobs="Job4;Job6"
Job13: dependent_jobs="Job12"
- These jobs have a task parameter "
The above described pre- and post-processings include the attached
control_parallel_execution_of_job_chains.js
file so that you have following small configuration
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