Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Minor corrections to text

...

The configuration of the return codes takes place in one of two ways:

  • The standard progression through the job chains of an order along a job chain is as follows:
    • When any of the jobs in either chain ends with an return code = 0, i.e. successfully, it the order will proceed to the job node 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 our series of Jobs, Job Chains and Orders articles. 
  • Workflow control is activated by specifying one or more on_return_code elements for a job chain node.
    One or more return_codes and one or more behaviors can be specified for each  on_return_code element.
    • A match of a job return code and a return_code attribute specified for that job node job will cause the behavior(s) 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.

...

  • The orderParameter value of 0 is shown in Line 56 of the listing.
  • Line 66 shows that Job 3 is exiting with return code 0.
  • The end of processing of the node for Job 3 is noted in line 70.
  • Line 71 shows that the state is set for starting Job 4 - there is no mention of the generation of the order that will start Job Chain B.

...

The next code block shows part of the log file for Order 1. This shows the log information for Job 3 and the start of Job 6. The following points are relevant:

  • Line 66 of the listing shows that Job 3 is exiting with return code 1.
  • The end of processing of the node for Job 3 is noted in line 70.
  • Line 70 shows that an error is logged
  • Line 71 shows that the state is set for starting Job 6 - the job at the node specified in the to_state element that was configured for node 3.

...

The next code block shows the last few lines of the log file for Order 1. Line 98 of the listing shows that despite the error recorded as Job 3 ended, the order is set to the success state.

...