You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

You can use locks to prevent a job start, while another job is running. You can find some informations about looks at http://www.sos-berlin.com/doc/en/scheduler.doc/lock.xml

Using locks, you have to

  1. declare a lock
  2. assign the lock to the involved jobs

Example

the lock

    <locks>
        <lock name="lockSample"/>
    </locks>

two jobs, assigned to the lock

 <?xml version="1.0" encoding="ISO-8859-1"?>
 <job order="yes"
     stop_on_error="no"
     name="jobsSample_1">
    <lock.use lock="lockSample"
              exclusive="yes"/>
    <script language="shell">
        <![CDATA[
 echo here is the job jobsSample_1
 echo I'm not running in parallel with job jobsSample_2
 ping -n 60 localhost
         ]]>
    </script>
    <run_time/>
 </job>
 <?xml version="1.0" encoding="ISO-8859-1"?>
 <job order="yes"
     stop_on_error="no"
     name="jobsSample_2">
    <lock.use lock="lockSample"
              exclusive="yes"/>
    <script language="shell">
        <![CDATA[
 echo here is the job jobsSample_2
 echo I'm not running in parallel with job jobsSample_1
 ping -n 60 localhost
         ]]>
    </script> 
    <run_time/>
 </job>

Two job chains using the jobs

 <?xml version="1.0" encoding="ISO-8859-1"?>
 <job_chain orders_recoverable="yes"
           visible="yes"
           name="job_chain1">
    <job_chain_node state="100"
                    job="jobsSample_1"
                    next_state="success"
                    error_state="error"/>
    <job_chain_node state="success"/>
    <job_chain_node state="error"/>
 </job_chain>
 <?xml version="1.0" encoding="ISO-8859-1"?>
 <job_chain orders_recoverable="yes"
           visible="yes"
           name="job_chain2">
    <job_chain_node state="100"
                    job="jobsSample_2"
                    next_state="success"
                    error_state="error"/>
    <job_chain_node state="success"/>
    <job_chain_node state="error"/>
 </job_chain>

Two orders assigned to the job chain

 <?xml version="1.0" encoding="ISO-8859-1"?>
 <order job_chain="job_chain1"
       id="test_lock1">
    <run_time let_run="no"/>
 </order>

<?xml versioh1. "1.0" encoding"ISO-8859-1"?>

 <order job_chain="job_chain2"
       id="test_lock2">
    <run_time let_run="no"/>
 </order>
  • No labels