Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Missing links added

...

Demonstration Files

Download: JobChainReturnCodes Example 1  working example (Windows Version), for Linux simply change modify the job's shell scripts with Linux scripts.

Unpack the configuration in the JobScheduler's Live folder. See ...... for further information about running JobScheduler. StatuscolourYellowtitleAdd linkour series of Tutorials for JobScheduler for information getting JobScheduler installed and running.

The configuration can now be:

Example

Use case

Consider two job chains where the return code for a job in one of the chains is used to control further workflow as follows:

...

  • The standard progression through the job chains is as follows:
    • When any of the jobs in either chain ends with an return code = 0, i.e. successfully, it will proceed to the job defined by the next_state
    • When any of the jobs ends with an return code other than 0, i.e. in error, then processing of the order will be stopped and the order will proceed to the error_state.
    • For more information about the principles of the jobs, job chains and orders elements used to configure JobScheduler workflows see  StatuscolourYellowtitleAdd linksee our series of Jobs, Job Chains and Orders articles. 
  • Workflow control is activated by specifying one or more on_return_code elements.
    • A match of a job return code and a return_code attribute specified for that job node job will cause the behavior specified for the on_return_code element to be carried out.
      Note that on_return_code elements are specified for the job chain node and not for the job, which is a child element of the node in the configuration. This allows jobs to be reused in other job chains with a different workflow control configuration.
    • Generation of the order to start Job Chain B:
      • If Job 3 in Job Chain A ends with an return code = 0 then an Order for Job Chain B will be generated by the JobScheduler and started. This is configured using an add_order element.
      • By default the generated order will have the ID of the originating order.
      • By default the generated order will have any parameters set for the originating order.
      • In addition
    • Skipping nodes in the current job chain:
      • If Job 3 in Job Chain A ends with a non-zero return code (in the example between 1 and 5) and a to_state element is set then JobScheduler behaves as follows:
        • Job 3 will be set to the error state.
        • The order will not proceed to the error_state but to the state specified in the state attribute of the to_state element.
          In the example this is state 6 for Job 6 as shown in the diagram above.
        • If no further jobs in the job chain end with a non-zero return code then the order will end with the success state.

...