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

Introduction

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

Locks are defined in files in the hotfolder hot folder (live). The name of the file is the name of the lock followed by .lock.xml. E.g. lockSample.lock.xml

Using locks, you have to

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

Example

To delclare the lock apply a configuration such as

Code Block

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

two jobs, assigned to To assign the lock to your jobs use

Code Block

 <?xml version="1.0" encoding="ISO-8859-1"?>
 <job order="yes"
     stop_on_error="no">
    <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>
 </job>
Code Block

 <?xml version="1.0" encoding="ISO-8859-1"?>
 <job order="yes"
     stop_on_error="no">
    <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> 
 </job>

Two job chains using the jobs

Code Block

 <?xml version="1.0" encoding="ISO-8859-1"?>
 <job_chain>
    <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>
Code Block

 <?xml version="1.0" encoding="ISO-8859-1"?>
 <job_chain>
    <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

Code Block

 <?xml version="1.0" encoding="ISO-8859-1"?>
 <order job_chain="job_chain1"</order>

...

Scope of locks

  • Where to store locks
    • Locks are stored directly in the live folder or any sub-folders.
  • How to reference locks in jobs
    • Locks are identified by their path that is made up of the folder where the lock is stored and of the name of the lock.
    • Locks that are located in the same folder as the job can address the lock by using its name (omitting the folder).
  • Example
    • Lock Location
      • Folder live/project_a contains a set of jobs and a lock my_lock_a
      • Folder live/project_b contains a set of jobs and a lock my_lock_b
    • Lock Usage
      • Job job_a from folder project_a can reference the lock from its folder by using e.g.
        <lock.use name="my_lock_a" exclusive="true"/> 
      • Job job_b from folder project_b can be configured accordingly to use its local lock. 
      • Should the jobs job_a and job_b be prevented to run in parallel then they have to use a common lock. This is achieved by referencing the same lock, e.g. job job_b would use a reference to my_lock_a from the folder project_a like this:
        <lock.use name="/project_a/my_lock_a" exlcusive="yes"/>
      • Caveat: It is possible to use the same lock name in different folders. This represents different locks. Jobs using relative addressing of locks by using the lock's name and omitting the folder name would reference the lock in their local folder. Consider to use absolute adressing of locks if you want jobs from different folders to make use of the same lock.