Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: 'Scope' extended

...

The Join Job (JobSchedulerJoinOrders) is used to join up two parallel executing child segments in a Job Chain. It then continues processing in a single thread once processing of the parallel threads has been completed. It is used in two Job Chain Patterns - Split and Join and "Y".

The This article describes how the Join Job can only be used within in a "Y" pattern, the How to Execute Jobs in a Job Chain in Parallel article describes it use in a Split and Join pattern.

The Join Job is only available for JobScheduler versions 1.11.4 and newer, .

Display feature availability
StartingFromRelease1.11.4

Join Patterns

The example described in this article shows the use of a single instance of the Join Job within a single Job Chain. Multiple instances of the Join Job can also be used within a Job Chain and the Job can also be used across multiple Job Chains. See the Configuration section of the JobSchedulerJoinOrders documentation for more information.  

split and join Pattern

The configuration of the Join Job for the Split and Join pattern is described in the How to Execute Jobs in a Job Chain in Parallel article.

...

  • Download the example y_join.zip
  • Extract the archive to a folder ./config/live of your JobScheduler Master installation.
  • The archive will extract the files to a folder y_join. 
  • The y_join folder can be renamed if required, the solution does not require the use of specific folder or Job names.

Implementation

The join Join Job has basically a counting function. This makes it significantly faster than the sync Sync Job which checks the IDs of the jobs being processed.

...

  • The required_orders parameter is read immediately by the join Job, which will then wait until the number of Orders specified in the parameter (here it is 12) have been processed.
    • Note that the join Join Job only counts orders that have the state of the join Job as their end state (here join).
  • The main_order moves to the generate_orders Job, which generates a total of 10 Child Orders.
    • This number is specified in a second parameter for the main_order - generate_orders.
    • 5 of these child orders start processing at node 150 and end at the join Join Job and 5 start at node 160 - that is, they take the other branch - and end at the join Joband end at the Join Job.
      • It is not important whether or not Child Orders take the same branch of the Job Chain as the main_order.
    • All these Child Orders will be counted towards the required_orders parameter.
    • Child Orders are given an Id based on the Parent Order ID plus a string.
  • The main_order itself then moves to the wait Job where it waits for a time specified in the Order's wait_time parameter (here 35 seconds).
    • The sole purpose of this delay is to demonstrate that the main_order can reach the join Join Job after the other Orders.
    • This delay is not necessary for the functioning of the join Join Job and the example will work with the wait_time parameter set to its minimum value of 1 (0 will cause an error).
  • When the main_order reaches the join Join Job it will be counted towards the number of Orders specified in the required_orders parameter, making a total of 11 after all the generated Child Orders have been completed.
    • Note that the main_order is the only Order that will be counted that does not have to have the state of the join Join Job as its end state.
  • The main_order will now be suspended at the join Join Job (without the Job being processed) until:
    • a further Order that has the state of the join Join Job as its end state is completed. 

The main_order_add-order Order can now be used to increase the the total number of Orders counted by the join Job.

  • In the current example, running the main_order_add-order Order once will case cause the number of Orders counted to reach the value set in the required_orders parameter.
    • The join Job will now process the Order the main_order which will then proceed along the Job Chain - in this example to the Job C with the state 200.
  • The ID of this Order has to follow the convention used for other Child Orders - that is, the ID of the parent Order

The Job Chain, Jobs and Orders

...