Table of Contents |
---|
Anchor | ||||
---|---|---|---|---|
|
The Join Orders Job (JobSchedulerJoinOrders) is a JITL Job and is used to join up parallel executing child segments in a Job Chain. It then continues processing with a single Order 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".
...
- See the How To Synchronize Job Execution Across Job Chains article for information about synchronizing using the Sync Job (JobSchedulerSynchronizeJobChains) to synchronize Jobs in different Job Chains and for joining to join up parallel executing child Job Chain segments in JobScheduler versions 1.11.3 and older.
- The Join Orders Job provides a plug-in replacement for the Sync Job (JobSchedulerSynchronizeJobChains) for sync/join operations within a Job Chain. As the Join Orders Job is significantly faster than the Sync Job, users of JobScheduler 1.11.4 or newer wishing to improve performance of the Sync Job can simply replace their Sync Job with the Join Orders Job.
...
The following diagram shows the "Y"-pattern Job Chain used in the example download archive that is linked from this article. Note that the generate and wait Jobs in this example have been included to make the example work and are not required for its operation in "normal" use.
Flowchart |
---|
main [label="Order:main_order",fillcolor="green"] 100 [label="generate orders",fillcolor="lightskyblue"] add [label="Order:main_order_add-order",fillcolor="green"] 150 [label="wait",fillcolor="lightskyblue"] 200 [label="200 job_a",fillcolor="lightskyblue"] 300 [label="300 job_b",fillcolor="lightskyblue"] join [label="join orders",fillcolor="lightskyblue"] 400 [label="400 job_c",fillcolor="lightskyblue"] success [label="success",fillcolor="orange"] main -> 100 100 -> 150 150 -> 200 200 -> join add -> 300 300 -> join join -> 400 400 -> success |
- Note that the generate and wait Jobs in this example have been included to make the example work and are not required for its operation in "normal" use.
- All Jobs in the "Y"-pattern are configured as a single Job Chain.
- The generate and wait Jobs in parallel arms of the example provide a convenient way of making the example work - they would not be required in a 'real' implementationare effectively job_a to the Join Orders Job and job_b to the Join Orders Job.
Download and Configure the Example
- 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 namesof specific folder or Job names. - Change the path to the example Job Chain in line 14 of the generate_orders Job below to the correct setting.
Example Description
To use the example, first start the Parent Order (in this example main_order). This Order has been configured with a number of three parameters, one of which - required_orders - is required by the Join Orders Job. The other two parameters - generate_orders and duration_wait_job are only used to provide a convenient way of making the example work.
...
- In the current example, running the main_order_add-order Order once will cause the number of Orders counted to reach the value set in the required_orders parameter (1210).
- The Join Orders Job will now process the main_order which will then proceed along the Job Chain - in this example to the Job C with the state 200400.
- The ID of this Order has to follow one of the convention conventions used for other to identify Child Orders - that is, . Here the ID of the parent Order plus an underscore plus a string has been used.
- Note that this string may not contain an underscore character ("_") and therefore the string "add-order" has been used.
Note that Child Orders such as the generated Orders or the manually started main_order_add-order Order in this example will only be recognized as such when they are started after the Parent Order has been started.
...
The Join Orders Job basically counts incoming Jobs. This makes it significantly faster than the Sync Job mentioned in the Scope section above, which checks the incoming Jobs for completeness.
...
Note that the Join Orders Job only counts orders Orders that have the state of the Join Orders Job as their end state (here join).
Anchor | ||||
---|---|---|---|---|
|
The configuration of the generate_orders Job is shown in the next code block along with the script responsible for the generation of the Child Orders.
...