Uploaded image for project: 'JS - JobScheduler'
  1. JS - JobScheduler
  2. JS-1193

Start of an order should be possible depending on the result of a task of a job chain node

    XMLWordPrintable

Details

    Description

      Plugin

      • A Plugin is provided that handles the return code of a previous job node:
        <NodeOrderPlugin:add_order NodeOrderPlugin:job_chain="/test-b"/>
        
      • The following modes are available for the handling of the Order ID when adding orders:
        • If no Order ID is specified then the order receives the Order ID of the current order. A different job chain has to be specified and that job chain must not contain an order with same Order ID.
        • The order is assigned an individual Order ID and job chain (which includes assigning the current job chain). The Order ID of the current order can be referenced by using the variable ${ORDER_ID}.
        • Examples
          • <add_order job_chain="..."/> adds an order with the same Order ID as the current order to a different job chain.
          • <add_order id=“${ORDER_ID}.1” job_chain="..."/> adds an order with parts of the Order ID being created from a reference to the Order ID of the current order. The current job chain or a different job chain can be used.
      • The handling of parameters is applied as follows:
        • A newly added order receives a copy of the parameters of the current order.
        • Additional parameters can be added by using the elements <add_order><params><param name="..." value="..."/>.... Additional parameters have precedence to parameters of the current order.
      • Any errors when adding the order to the job chain are logged and ignored.

      Configuration
      Following configuration has to be applied to scheduler.xml to enable the corresponding plugin:

      <?xml version="1.0" encoding="utf-8"?>
      <spooler xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.sos-berlin.com/repository/scheduler/1.7/scheduler.xsd">
          <config>
              <plugins>
                  <plugin java_class="com.sos.scheduler.engine.plugins.nodeorder.NodeOrderPlugin"/>
              </plugins>
          </config>
      </spooler>
      

      Complete sample job chain

      <?xml version="1.0" encoding="utf-8"?>
      <job_chain
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:noNamespaceSchemaLocation="http://www.sos-berlin.com/repository/scheduler/1.9/scheduler.xsd"
              xsi:schemaLocation="https://jobscheduler-plugins.sos-berlin.com/NodeOrderPlugin NodeOrderPlugin.xsd"
              xmlns:NodeOrderPlugin="https://jobscheduler-plugins.sos-berlin.com/NodeOrderPlugin">
          <job_chain_node state="200" job="/test-exit-7">
              <on_return_codes>
                  <on_return_code return_code="7">
                      <NodeOrderPlugin:add_order NodeOrderPlugin:job_chain="test-a"/>
                  </on_return_code>
                  <on_return_code return_code="5">
                      <NodeOrderPlugin:add_order NodeOrderPlugin:job_chain="./test-b"/>
                      <NodeOrderPlugin:add_order NodeOrderPlugin:job_chain="/other-folder/test-c" NodeOrderPlugin:id="${ORDER_ID\u0022}-copy"/>
                  </on_return_code>
                  <on_return_code return_code="9">
                      <add_order xmlns="https://jobscheduler-plugins.sos-berlin.com/NodeOrderPlugin" job_chain="/x">
                          <params>
                              <param name="a" value="AAA"/>
                              <param name="b" value="BBB"/>
                          </params>
                      </add_order>
                      <to_state state="end"/>
                  </on_return_code>
              </on_return_codes>
          </job_chain_node>
          <job_chain_node.end state="end"/>
      </job_chain>
      

      Explanations

      • The NodeOrderPlugin allows to specify absolute and relative paths for job chains. Relative paths are based on the location of the current job chain.
      • Multiple orders (in different job chains) can be started for the same return code.
      • The job chain path of the new order can be used relative to the current job chain. Just let the path start with "./".
      • Mixed usage for orders that should be added and for the job node state that an order should move to is possible.

      To use the plugin, it has to be included in the JobScheduler configuration file scheduler.xml:

      <?xml version="1.0" encoding="utf-8"?>
      <spooler xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://www.sos-berlin.com/repository/scheduler/1.9/scheduler.xsd">
          <config>
              <plugins>
                  <plugin java_class="com.sos.scheduler.engine.plugins.nodeorder.NodeOrderPlugin"/>
              </plugins>
          </config>
      </spooler>
      

      Restriction

      • As of now JobScheduler release 1.9.RC1 there is a restriction on target job chain configuration.
      • If a target job chain is present in same folder where job chain configured to send order is present, target job chain can not be referred directly.
      • Which means target job chain can only be referred with a relative or absolute path.
      • Please see the example of restriction;
        <add_order xmlns="https://jobscheduler-plugins.sos-berlin.com/NodeOrderPlugin" 
                            job_chain="03_JobChainB"/>
      • Above mentioned configuration of target job chain will not work.

      Attachments

        1. JOC-error-JS1193.png
          JOC-error-JS1193.png
          165 kB
        2. RELEASE-TEST-1.9.zip
          10 kB
        3. RELEASE-TEST-1.9.zip
          10 kB
        4. scheduler-djmp-snapshot-1.9.log.zip
          141 kB

        Issue Links

          Activity

            People

              mp Mahendra Patidar
              ss Stefan Schädlich (Inactive)
              Mahendra Patidar Mahendra Patidar
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 4 days
                  4d
                  Remaining:
                  Remaining Estimate - 4 days
                  4d
                  Logged:
                  Time Spent - Not Specified
                  Not Specified