Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents
outlinh1. true
outlinh1. true
1printablefalse
2stylh1. none
3indent20px

...

Components

Job: sync

  • Define a sync job.
  • Add the

...

  • parameters ParallelExecution_required_orderh1. 2 and ParallelSample_required_orders1. 
  • The value of the parameter ParallelExecution_required_orders is the number of entry points in the job chain ParallelExecution (see below).

 

 

Code Block
languagexml
titleSource for job: sync
collapsetrue
 <?xml version="1.0" encoding="ISO-8859-1"?>
  <job order="yes">
    <params>
        <param name="ParallelExecution_required_orders" value="2"/>
        <param name="ParallelSample_required_orders"    value="1"/>
    </params>
    <script language="java"
            java_class="sos.scheduler.job.JobSchedulerSynchronizeJobChains"/>
    <run_time/>
 </job>

Job: execute

  • Define a job execute.
  • This is

...

  • Javascript API job

...

  • that will create orders for

...

  • parallel execution. 
  • Set the parameter job_chain to the value /SampleParallel/ParallelExecution.

 

 

Code Block
languagexml
titleSource for job: execute
collapsetrue
 <?xml version="1.0" encoding="ISO-8859-1"?>
 <job order="yes">
    <params>
        <param name="job_chain"  value="/SampleParallel/ParallelExecution"/>
    </params>

    <script language="javascript"><![CDATA[
 		function spooler_process() {
		   	var actOrder = spooler_task.order;
   			var order = spooler.create_order();
   			var job_chain = spooler.job_chain( spooler_task.params.value( "job_chain" ) );
   			order.state = actOrder.state;
   			order.params.merge(actOrder.params);
   			order.id = order.state + ":" + actOrder.id;
   			job_chain.add_or_replace_order(order);   
   			return true;
 		}
    ]]></script>

    <monitor name="configuration_monitor"
             ordering="0">
        <script java_class="sos.scheduler.managed.configuration.ConfigurationOrderMonitor"
                language="java"
                java_class_path=""/>
    </monitor>

    <run_time/>
 </job>

Job Chain: ParallelExecution

  • Define a job chain ParallelExecution. 
  • This job chain has several entry points. One for each parallel execution.
  • In this example we

...

  • use two entry points named p1 and p2. 
    • p1 is assigned a job and has a next state

...

    • p1.b that executes a second job.
    • p2 just executes one job.
    • Both p1 and p2 end in a sync node.

  Both ends at sync.

 

Code Block
languagexml
titleSource for job chain: ParallelExecution
collapsetrue
 <?xml version="1.0" encoding="ISO-8859-1"?>
 <job_chain orders_recoverable="yes">
    <job_chain_node state="p1"
                    job="ParallelJob1"
                    next_state="p1.b"
                    error_state="error"/>
    <job_chain_node state="p1.b"
                    job="aJob"
                    next_state="sync"
                    error_state="error"/>
    <job_chain_node state="p2"
                    job="ParallelJob2"
                    next_state="sync"
                    error_state="error"/>
    <job_chain_node state="sync"
                    job="Sync"
                    next_state="success"
                    error_state="error"/>
    <job_chain_node state="success"/>
    <job_chain_node state="error"/>
 </job_chain>

Job Chain: ParallelSample

  • Define a job chain ParallelSample.
  • This job chain starts the jobs that

...

  • should be executed in parallel and can have one scheduled order. 
  • There can also be steps before and after the jobs to be executed in parallel. 
  • Add a step for each job to be executed in parallel. The state of this step must be the same as in job chain ParallelExecution. In this example it is p1 and p2.

 

 

Code Block
languagexml
collapsetrue
 <?xml version="1.0" encoding="ISO-8859-1"?>
 <job_chain orders_recoverable="yes"
           visible="yes">
    <job_chain_node state="100"
                    job="anyJobBefore"
                    next_state="p1"
                    error_state="error"/>
    <job_chain_node state="p1"
                    job="execute"
                    next_state="p2"
                    error_state="error"/>
    <job_chain_node state="p2"
                    job="execute"
                    next_state="sync"
                    error_state="sync"/>
    <job_chain_node state="sync"
                    job="Sync"
                    next_state="200"
                    error_state="error"/>
    <job_chain_node state="200"
                    job="anyJobAfter"
                    next_state="success"
                    error_state="error"/>
    <job_chain_node state="success"/>
    <job_chain_node state="error"/>
 </job_chain>

...

Code Block
languagexml
collapsetrue
 <?xml version="1.0" encoding="ISO-8859-1"?>
 <order>
    <run_time>
        <period single_start="10:00"/>
    </run_time>
 </order>

Related Downloads

You can download the source for this example from here.

...