Scope
- Use Case
- Make a job chain start at a certain point in time after an arbitrary number of other job chains completed successfully.
- The predecessor job chains run in arbitrary sequence at arbitrary points in time.
- Example
- Job Chain Z runs after 10 other job chains have completed.
Solution
- Download: final_chain.zip
- Extract the archive to a
./config/live/issues
folder of your JobScheduler installation. - The archive will extract the files to a sub-folder
final_chain.
- You can store the sample files to a any folder as you like, however, you will to adjust the job parameters accordingly.
Pattern
Implementation
Components
- The solution contains three job chains:
job_chain_A
andjob_chain_B
represent the predecessor job chains that have no relevant dependencies withjob_chain_Z
.job_chain_Z
is the final job chain that checks ifjob_chain_A
andjob_chain_B
have previously been executed successfully.
- The solution implements a job
check_predecessor_job_chain_Z
that has been added to the top ofjob_chain_Z
.- This job is parameterized with any number of parameters that start with the prefix "check_predecessor" and use an arbitrary suffix that is required in order to create unique parameter names. The value of each parameter is the final job of the respective job chain that is checked for successful execution:
- Example
check_predecessor_A = issues/final_chain/do_something_job_chain_A
check_predecessor_B = issues/final_chain/do_something_job_chain_B
- Should the sample files not have been extracted to the
./config/live/issues/final_chain
folder then please adjust the parameter value to point to the respective directory.
- Example
- This job implements a
spooler_process()
function that reads the parameters and checks the job history for successful execution of jobs as specified by the parameters. - Should all checks for previous successful execution provide a positive result, then the current order is moved to the next job chain node. Otherwise the current order is set back an will repeat several times depending on the setback configuration of this job.
- This job is parameterized with any number of parameters that start with the prefix "check_predecessor" and use an arbitrary suffix that is required in order to create unique parameter names. The value of each parameter is the final job of the respective job chain that is checked for successful execution:
Usage
- Positive Check
- Add an order to
job_chain_A
by use of the JOCAdd Order
context menu.- The order should pass through the job chain without errors.
- Add an order to
job_chain_B
by use of the JOCAdd Order
context menu.- The order should pass through the job chain without errors.
- Add an order to
job_chain_B
by use of the JOCAdd Order
context menu.
- 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 to the job script. - Add an order to
job_chain_A
.- The order should pass with an error.
- Add an order to
job_chain_Z
- The order should pass with an error that is visible from the order log stating that the predecessor job did not complete successfully.
- The order is set back and will repeat several times depending on the setback intervals that have been specified with 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