Job Locks
Multiple Jobs or Workflows can be scheduled to run at any given time. However, some may have dependencies that forbid simultaneous execution.
Job Locks prevent simultaneous execution of specific Jobs or Workflows. You can think of a Job Lock as a unique object that only one Job can have at a time. If Job B requires a Job Lock, but Job A is still using that Job Lock, Job B must wait until Job A releases the Job Lock before it can execute. Job B is put into status LockWait until it gets the Job Lock it needs to execute.
There are three types of Job Locks. These are described in more detail below.
-
Simple: A simple Job Lock can be held by only one Job or Workflow at a time.
-
Counted: A Counted Lock can be held by a specific number of Jobs or Workflows at a time. The number of Jobs or Workflows that can share a Counted Lock is that Counted Lock's Maximum.
-
Shared/Exclusive: A Shared/Exclusive Job Lock works differently depending on whether you use it as a Shared Lock or an Exclusive Lock (see below).
To create a Job Lock, navigate to Configure > Automate > Scheduling tools > Job Locks.
To associate a Job Lock with a Job or Workflow Definition, use the Locks tab.
Note: If you need to constrain a large number of Jobs , you can instead use a Queue with a queue limit of one, so that only one Job can run in the Queue at any given time.
Simple Locks
A simple lock can be held by only one Job or Workflow at a time.
Counted Locks
Counted Locks let you specify that a certain number of Jobs or Workflows can hold the same Job Lock simultaneously. For example, if a Counted Lock has a Maximum of 3, three different Jobs that are associated with that Job Lock can execute at the same time.
Jobs and Workflows that are associated with Counted Locks can require more than one Job Lock to run. For example, you can configure a Job Definition to require a Job Lock count of 3. If you associate that Job Definition with a Counted Lock with a Maximum of 9, then three instances of that Job can execute at the same time.
Shared/Exclusive Locks
Like a Counted Lock, a Shared/Exclusive Lock has a count. However, when you select a Shared/Exclusive Lock in a Job or Workflow Definition, you can choose whether to use it as an Exclusive Lock or a Shared Lock.
-
If you choose to use it as an Exclusive Job Lock, then the Job or Workflow holds its entire Lock count.
-
If you choose to use it as a Shared Job Lock, then the Job or Workflow holds a Lock count of one.