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

Compare with Current View Page History

« Previous Version 5 Next »

Purpose

  • Specify a number of job nodes for mutual exclusion to prevent such jobs from being executed in parallel.
  • Mutual exclusion is based on Locks, i.e. semaphores, that allow to be used either exclusively or that can be shared within limits.
    • Exclusive Lock: only one Lock Instruction can hold the Lock at any given time. Any further Lock Instructions that try to acquire the same Lock will wait.
    • Shared Lock: the Lock is assigned a limit that can be shared by a number of Lock Instructions. Each Lock Instruction carries a weight that counts towards the Lock's limit.
  • Jobs that wait to acquire a Lock do not consume resources such as CPU. Orders that wait for a Lock are in a WAITING state, see JS7 - Order State Transitions.
  • If a job within a Lock Instruction fails then the order is considered being failed. In this situation the Lock is still in use by the Lock Instruction.
  • Consider that Lock Instructions can be nested in a workflow to acquire a number of Locks. This adds complexity to your workflows that should be managed to prevent deadlocks and not to block a number of Locks for a longer time by failed orders.

Lock

A lock is easily configured by assigning a name and a limit for parallel access.

Workflow Instruction: Lock

Exclusive Lock

Download Workflow Example: pdlExclusiveLockSerial_001.json



Explanations:

  • The selected Lock Instruction makes us of the above Lock in exclusive mode, i.e. jobs in other Lock Instructions for the same Lock are prevented from starting until they can acquire the Lock.
  • You could copy the example workflow and add an order to each workflow. As a result the workflow of the first order will run the respective jobs, the workflow of the second order will wait.
  • You achieve similar results by adding a number of orders to the same workflow.

Shared Lock

Download Workflow Example: pdlSharedLockParallel_001.json



Explanations:

  • The selected Lock Instruction makes us of the above Lock in shared mode, i.e. other Lock Instructions can acquire the same Lock if their weight (in this example: 5) fits to the Locks' limit (in the above example: 12). Any further Lock Instructions that will not fit to the Lock's limit are prevented from starting jobs until they can acquire the Lock.
  • You can copy the above example workflow or add a number of orders to the same workflow to check the behavior. As the Lock's limit is 12 therefore 2 orders each using a Lock Instruction of weight 5 can execute in parallel, a third order will wait until the respective Lock Instruction can acquire the Lock.

Locks View

The Resources => Locks view allows to monitor use of Locks by orders and workflows including Lock Instructions.



Explanations:

  • The example shows two Locks being used: the pdlLockBig (limit: 12) and the pdlLockSmall (limit: 2) Locks.
  • Each Lock is acquired by an order that is in RUNNING state.
  • At the same time two additional orders are trying to acquire the same Locks. Both orders are in a WAITING state until they can acquire the respective Lock.


  • No labels