Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Intermediate save

...

  • See the How To Synchronize Job Execution Across Job Chains article for information about synchronizing Jobs in different Job Chains and for joining 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. This means that 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 exchange the Jobs.

The Join Orders Job

The Join Orders Job is a Java JITL Job that is configured using the Job Wizard in the JobScheduler Object Editor, JOE.

The Join Orders Job cannot execute a shell script.

Join Patterns

  • replace their Sync Job with the Join Orders Jo

Join Patterns

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

...

Flowchart
main [label="Order:main_order",fillcolor="green"]
generate [label="generate",fillcolor="lightskyblue"]
add [label="Order:main_order_add-order",fillcolor="green"]
100 [label="Job Await",fillcolor="lightskyblue"]
150 [label="150",fillcolor="lightskyblue"]
160 [label="160",fillcolor="lightskyblue"]
join [label="join orders",fillcolor="lightskyblue"]
200 [label="200",fillcolor="lightskyblue"]
success [label="success",fillcolor="orange"]

main -> generate
generate -> 100 
100  -> 150 
150 -> join 
add -> 160 
160 -> join 
join -> 200 
200 -> success 

...

Example Description

The Join Orders Job has basically a counting functionbasically counts incoming Jobs. This makes it significantly faster than the Sync Job which checks the incoming jobs Jobs for completeness.

To use the example, first start the Parent Order (in this example main_order). This Order has been configured with a number of parameters, one of which - required_orders - is required by the Join Orders Job.

...

Code Block
languagexml
titleThe y_join Job Chain
linenumberstrue
collapsetrue
<?xml version="1.0" encoding="ISO-8859-1"?>

<job_chain  title="Y Join">
    <job_chain_node  state="100" job="generate_orders" next_state="120" error_state="error"/>
    <job_chain_node  state="120150" job="job_await" next_state="150" error_state="error"/>
    <job_chain_node  state="150200" job="job_ba" next_state="join" error_state="error"/>
    <job_chain_node  state="160300" job="job_cb" next_state="join" error_state="error" delay="10"/>
    <job_chain_node  state="join" job="join" next_state="200" error_state="error"/>
    <job_chain_node  state="200400" job="job_dc" next_state="success" error_state="error"/>
    <job_chain_node  state="success"/>
    <job_chain_node  state="error"/>
</job_chain>

The Jobs

The Join Orders Job

The configuration of the Join Orders Job is can set using the JITL Job Wizard in JOE and is shown in following code block. Relevant for users in the following listing is the show_join order list parameter which may be optionally set (default is false). Setting this Parameter to true causes a list of all the orders counted by the Join Orders Job to be written to the Parent Order log file for the Parent Order.

Code Block
languagexml
titleThe Join Orders Job
linenumberstrue
collapsetrue
<?xml version="1.0" encoding="ISO-8859-1"?>

<job  order="yes" stop_on_error="no" idle_timeout="60" title="Join Job">
    <settings >
        <log_level ><![CDATA[debug9]]></log_level>
        <history_on_process ><![CDATA[0]]></history_on_process>
        <history_with_log ><![CDATA[gzip]]></history_with_log>
    </settings>

<job  order="yes" stop_on_error="no" idle_timeout="60" title="Join Job">
    <params >
        <param  name="show_join_order_list" value="true"/>
    </params>
    <script  language="java" java_class_path="" java_class="com.sos.jitl.join.JobSchedulerJoinOrdersJSAdapterClass"/>
    <run_time />
</job>

...

Code Block
languagexml
titleThe generate_orders Job
linenumberstrue
collapsetrue
<?xml version="1.0" encoding="ISO-8859-1"?>

<job  order="yes" stop_on_error="no">
    <script  language="java:javascript">
        <![CDATA[
function spooler_process(){

    // merge parameters from task and order
    var params = spooler_task.params;
    params.merge( spooler_task.order.params );
 
    // set variable
    var generate_orders = params.value( 'generate_orders' );
    var jobChain = spooler.job_chain('/test/join/y_join/y_join');

    // log parameter
    spooler_log.info( 'generate_orders = ' + generate_orders);
 
    // generate orders
    for (i=0;i<generate_orders;i++){
       var order = spooler.create_order();
       order.id = spooler_task.order.id + "_" + i;
       order.params.merge(spooler_task.order.params);
       order.end_state="join";
       if((i%2)==1) {
          order.state="150200";
       } else {
          order.state="160300";
       }
       jobChain.add_order(order);
    }

    return true;
}
        ]]>
    </script>

    <run_time />
</job>

...

  • This Job contains a script that generates the Child Orders (see lines 20 - 31 of the listing).
    • The Orders are alternated between the two branches of the Job Chain (even numbered Orders start at the Job corresponding with the Order state 150 and odd numbered Orders at the Job corresponding with the Order state 160). All Child Orders terminate at the Join Orders Job.
    • The total number of orders generated is determined by the generate_orders parameter.
The wait Job

...

The wait Job A is configured to read the duration_wait_job_a parameter and execute a simple script (i.e. ping local host for the length of time specified in the parameter). This script causes the Job to wait for the number of seconds specified in the parameter.

...

  • required_orders
    • This parameter (Default 1210.)
    • This parameter is required for the Join Job.
  • duration_wait_job_a
    • this is the time in seconds that the wait Job A will wait before the main Order moves to the Join Orders Job. (Default 35 30 secs.)
    • The duration_job_a parameter is only used in the wait Job A as part of this example and is not necessary for the functioning of the Join Orders Job.
  • generate_orders
    • this is the number of Orders that are to be generated by the generate_orders Job. (Default 108.) 
    • The generate_orders parameter is used in the Generate Job as part of this example to specify the number of Child Orders that should be generated. This parameter is not necessary for the functioning of the Join Job as the Jobs counted by the Join Job could come from any number of sources..

Code Block
languagexml
titleThe main_order Order
linenumberstrue
collapsetrue
<?xml version="1.0" encoding="ISO-8859-1"?>
<order >
    <params >
        <param  name="required_orders" value="1210"/>
        <param  name="duration_job_a" value="3530"/>
        <param  name="generate_orders" value="108"/>
    </params>
    <run_time />
</order>

...

Have either:

  • <order state="150200" end_state="join"> or
  • <order state="160300" end_state="join">

depending on which branch of the Job Chain they should be executed on.

...

This Order is configured with:

  • state = 150300 (The state in the Job Chain where the main_order_add-order Order starts processing. Here this corresponds to is job_ab) and
  • end_state = join (The state corresponding to the Join Job) This means that this Order will be registered by the Join Job as counting towards the required orders.
Code Block
languagexml
titleThe main_order_add-order Order
linenumberstrue
collapsetrue
<?xml version="1.0" encoding="ISO-8859-1"?>
<order  state="150300" end_state="join">
    <run_time />
</order>

...