Scope

  • Components for dependency handling
  • Download & Deployment information

Download & Deployment

  • JobScheduler
    • FEATURE AVAILABILITY STARTING FROM RELEASE 1.7 FEATURE AVAILABILITY ENDING WITH RELEASE 1.8

    • This feature requires Java 1.7 to be available. It will not work with Java 1.8 and therefore not with JobScheduler releases starting from 1.9.
  • Dependency
    • Attached archive contains the below mentioned files for the dependency folder: dependency.zip
    • The archive should be extracted to a subfolder of the JobScheduler live/sos directory, i.e. $SCHEDULER_DATA/config/live/sos/dependency.

Global Setting: scheduler.ignore_sync_jobs_in_stopped_jobchains

  • Dependency handling requires the new option scheduler.ignore_sync_jobs_in_stopped_jobchains
  • Enabling this option by setting the scheduler variable in the configuration file $SCHEDULER_DATA/scheduler.xml to true will ignore synchronization nodes that are part of stopped job chains for all instances of synchronization jobs.

    Configuration in file scheduler.xml
    <spooler>
        <config>
            <param name="scheduler.ignore_sync_jobs_in_stopped_jobchains" value="true"/>
    ...
  •  It is also possible to enable this option per job by adding a job parameter like this:

    Configuration by job parameter
    <job  order="yes">
        <params >
            <param  name="scheduler.ignore_sync_jobs_in_stopped_jobchains" value="true"/>
        </params>
    ...

Folder: dependency

  • This folder provides the components required to implement dependency handling.
  • This folder should be located below the JobScheduler live directory.

Function Set: dependency.js

  • This function set provides basic capabilities for dependency checking
  • This function set is used by the following job Monitor Scripts:
    • jobnet_check_predecessor.js
    • jobnet_check_successor.js

Job: jobnet_check_predecessor.job.xml

Usage

  • Sample job for a job step that provides dependency checking.
  • This job is added to the beginning of a job chain.
  • This job step is added the job node state jobnet_start.

Sample

Job Implementation

  • The job implements an arbitrary job body.
  • Dependency handling is implemented by the Monitor Script.
    • The Monitor Script includes two files:
      • jobnet_check_predecessor.js
      • dependency.js
    • When creating individual job implementations then no invidual implementation of the Monitor Script should be effected but the below-mentioned script files should be included as they are subject to future improvement.

 

Job: jobnet_check_predecessor.job.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<job  order="yes" stop_on_error="no" title="check jobnet predecessors">
    <script  language="java:javascript">
        <![CDATA[
spooler_log.info("checking jobnet predecessors");
        ]]>
    </script>
    <monitor  ordering="0" name="monitor">
        <script  language="java:javascript">
            <include  file="config/live/sos/dependency/jobnet_check_predecessor.js"/>
            <include  file="config/live/sos/dependency/dependency.js"/>
        </script>
    </monitor>
    <run_time />
</job>

 

  • The Monitor Script makes use of the function set provided by the file dependency.js in order to handle dependencies for predecessor job chains.
  • The Monitor Script checks predecessor job chains in order to decide if the current job chain should be executed or if its execution shoud be postponed..

 

Monitor Script: jobnet_check_predecessor.js
function spooler_process_after( spooler_process_result ) {

    spooler_log.info( "spooler_process_after(): checking jobnet predecessor" );


    if ( spooler_process_result ) {
        // check if predecessor job chains exists and will start in period
        if ( isPredecessorJobChainInPeriod() ) {
            spooler_log.info( "spooler_process_after(): predecessor job chain will start later in period, order execution postponed, moving order to final state: " + getStateSkip() );
            var order = spooler_task.order();
            order.set_state( getStateSkip() );
        } else {
            spooler_log.info( "spooler_process_after(): no predecessor job chain found for consideration that will start later in period, order is continued" );
		}
    } else {
        spooler_log.info( "spooler_process_after(): no predecessor checking due to failed job processing" );
    }


    return spooler_process_result;
}

 

Job: jobnet_check_successor.job.xml

Usage

  • Sample job for a job step that provides dependency checking.
  • This job is added to the end of a job chain.
  • This job step is added the job node state jobnet_end.

Sample

  • see job jobnet_check_successor from the above screenshot

Job Implementation

  • This job implements an arbitrary job body.
  • Dependency handling is implemented by the Monitor Script.
    • The Monitor Script includes two files:
      • jobnet_check_successor.js
      • dependency.js
    • When creating individual job implementations then no invidual implementation of the Monitor Script should be effected but the below-mentioned script files should be included as they are subject to future improvement.

 

Job: jobnet_check_successor.job.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<job  order="yes" stop_on_error="no" title="check jobnet successors">
    <script  language="java:javascript">
        <![CDATA[
spooler_log.info("checking jobnet successors");
        ]]>
    </script>
    <monitor  ordering="0" name="monitor">
        <script  language="javax.script:rhino">
            <include  file="config/live/sos/dependency/jobnet_check_successor.js"/>
            <include  file="config/live/sos/dependency/dependency.js"/>
        </script>
    </monitor>
    <run_time />
</job>

 

  • The Monitor Script makes use of the function set provided by the file dependency.js in order to handle dependencies for successor job chains.
  • The Monitor Scripts starts successor job chains if applicable.

 

Monitor Script: jobnet_check_successor.js
function spooler_process_after( spooler_process_result ) {

    spooler_log.info( "spooler_process_after(): checking jobnet successor" );


    if ( spooler_process_result ) {
        // start orders for successor job chains
        var numOfOrders = startSuccessorJobChains();
        if ( numOfOrders > 0 ) {
            spooler_log.info( "spooler_process_after(): " + numOfOrders + " orders for successor job chains started" );
        } else {
            spooler_log.info( "spooler_process_after(): no successor job chain found for consideration, no orders started" );
        }
    } else {
        spooler_log.info( "spooler_process_after(): no successor checking due to failed job processing" );
    }


    return spooler_process_result;
}

Components for Job Chain Resets

  • The following components are included with the folder dependency

Job Chain: jobnet_reset_job_chains.job_chain.xml

  • The job chain makes use of only one job jobnet_reset_job_chains.job.xml, see below.

Job: jobnet_reset_job_chains.job.xml

Usage

  • Standard job that is used to toggle the state of job chains for dependency checking. Job chains present one of these states:
    • running: the job chain is active and dependency checking is performed
    • stopped: the job chain is inactive, no dependency checking is performed.

Job Implementation

  • This job implements the operations to toggle the state of one or multiple job chains.
  • The effective processing is implemented by JavaScript.

 

Job: jobnet_reset_job_chains.job.xml
<?xml version="1.0" encoding="ISO-8859-1"?>

<job  order="yes" stop_on_error="no" title="reset job chaines to unstopped or stopped state">
    <script  language="java:javascript">
        <include  file="config/live/csi/dependency/jobnet_reset_job_chains.js"/>
        <include  file="config/live/csi/dependency/dependency.js"/>
    </script>
    <run_time />
</job>

 

  • The JavaScript implementation:

 

JavaScript: jobnet_reset_job_chains.js
function spooler_process( ) {
    spooler_log.info( "spooler_process(): reset job chains in jobnet" );
    
    var numOfModifiedJobChains = toggleJobChainState();
    
    spooler_log.info( "spooler_process(): " + numOfModifiedJobChains + " job chains modified" );
    return true;
}

Order: jobnet_reset_job_chains.order.xml

  • This is a sample order that shows how job chains could be selected for activation and deactivation.
  • Parameters
    • operation: the toggling operation
      • Values
        • activate: modify the state of stopped job chains to running
        • deactivate: modify the state of running job chains to stopped
      • Default Value
        • activate
    • input_list:
      • Values
        • A comma separated list of job chain paths
      • Default Value
        • none
    • input_file
      • Values
        • the location of a file that contains one job chain path per line
      • Default Value
        • none
  • Behaviour
    • Without parameters being specified all job chains will be activated.
    • Without the parameters input_list and input_file being specified the operation is applied to all job chains.
    • Should in addition to the parameter input_list the  parameter an input_file be specified then both specifications of job chains are merged.

 

Order: jobnet_reset_job_chains.order.xml
<?xml version="1.0" encoding="ISO-8859-1"?>

<order  title="reset job chaines to unstopped or stopped state">
    <params >
        <param  name="operation" value="deactivate"/>
        <param  name="input_list" value="jobnet/examples/JobChain_B/job_chain_B,csi/examples/JobChain_D/job_chain_D"/>
        <param  name="input_file" value="jobnet/jobnet_reset_job_chains.txt"/>
    </params>
    <run_time  let_run="no">
        <period  single_start="24:00"/>
    </run_time>
</order>

Notes

  • Dependency Hnandling Scripts and Monitor Scripts are
    • implemented for the Rhino scripting engine up to Java 1.7 with JobScheduler release 1.7 and 1.8.
    • not available with the Nashorn engine that is introduced with Java 1.8 and is required for JobScheduler release 1.9.

 

 

 

  • No labels