Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

Scope

  • Use Case:
    • Consider the situation where:
      • A
    • Make a
      • job chain is to start at a certain point in time and after an arbitrary number of other
      job chains
      • jobs have been completed successfully.
      • The predecessor job chains run in an arbitrary sequence at arbitrary points in time.
  • Example:
    • Job Chain chain Z runs after 10 2 other job chains A and B have completed.

Solution

  • Download: FinalChainfinal_chain_job_history.zip
  • Extract the archive to any folder within the a folder in your JobScheduler installation named ./config/live folder of your JobScheduler installation.
  • The archive will extract the files to a sub-folder final_chain_job_history. 
  • You Note that you can store the sample files to a in any folder as you like, the solution does not make use of specific folder names or job names.

Pattern

Flowchart
order_A [shape="ellipse",label="Order A\n start time: Friday 08:00 ",fillcolor="violet"]
order_B [shape="ellipse",label="Order B\n start time: Friday 07:00 ",fillcolor="violet"]
order_Z [shape="ellipse",label="Order Z\n start time: Friday 15:00 ",fillcolor="violet"]
 
job_chain_A [label="Job Chain A\nhas no relevant dependencies",fillcolor="orange"]
job_A [label="Job do_something_job_chain_A",fillcolor="lightskyblue"]

job_chain_B [label="Job Chain B\nhas no relevant dependencies",fillcolor="orange"]
job_B [label="Job do_something_job_chain_B",fillcolor="lightskyblue"]
 
job_chain_Z [label="Job Chain Z\nstarts at an arbitrary point in timendepends on the execution of\nJob Chain A and Job Chain B",fillcolor="orange"]
job_check_predecessor [label="Job check_predecessor",fillcolor="lightskyblue"]

job_next_job [label="Next Job", fillcolor="lightskyblue"]
check_predecessor_successful [shape=diamond,label="execution successful\nfor jobs in Job Chain A and Job Chain B?",fillcolor="white"]
order_Zsetback [shape="ellipse",label="Order Z\n start time: Saturday 15:00 Set back Order",fillcolor="violetwhite"]

order_setback [label="Setback Order",fillcolor="white"]
 A -> job_chain_A -> job_A
order_B -> job_chain_B -> job_B
order_Z -> job_chain_Z -> job_check_predecessor
job_chaincheck_Zpredecessor -> job_A
job_check_predecessor -> job_B
job_check_predecessor -> check_predecessor_successful
check_predecessor_successful -> job_next_job [label=" yes "]
check_predecessor_successful -> order_setback [label=" order setbackno "]
order_setback -> job_check_predecessor

...

Implementation

Components

  • The solution contains three job chains:
    • job_chain_A and job_chain_B represent the predecessor job chains that have no relevant dependencies with job_chain_Z.
    • job_chain_Z is the final job chain that checks if job_chain_A and job_chain_B have already been executed successfully.
  • The solution implements a job check_predecessor_job_chain_Z that has been added at the start of job_chain_Z.
    • This job makes use of a parameter check_jobs that is assigned a semicolon separated list of job names.
      • Job names can be specified with an absolute path (starting from the live folder) or with a path relative to the directory of this job.
      • Example:
        • check_jobs = job_do_something_job_chain_A;job_do_something_job_chain_B
    • This job implements a spooler_process() function that reads the parameter and checks the job history for successful execution of the jobs specified by the parameter.
    • Should all checks for previous successful execution provide a positive result then the current order will be moved to the next job chain node. Otherwise the current order is set back and will be repeated regularly according to the setback configuration for this job.

Usage

  • Positive Check
    • Add an order to job_chain_A using JOC's Add Order context menu.
      • The order should pass through the job chain without errors.
    • Add an order to job_chain_B using JOC's Add Order context menu.
      • The order should also pass through the job chain without errors.
    • Add an order to job_chain_Z using JOC's Add Order context menu.
      • The order should pass through the job chain without errors as all pre-conditions are met.
  • Negative Check
    • Modify the job do_something_job_chain_A to include an error, e.g. by adding the command exit 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 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 to job_chain_A that then runs successfully should result in a successful run of job_chain_Z - either by a new order added to job_chain_Z or by the next execution of the previous order that has been set back.

See also