Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Use Case:
    • Consider the situation where a number of orders that have been added to a job chain. These orders should then be serialized to guarantee that each order has completed the job chain before the next order starts.
    • Consider the situation that a number of job chains makes use of the same resource, e.g. by access to objects in a database. These orders should be serialized to guarantee that only one order of one job chain can access the resource at the same time.
  • Solution Outline:
    • The solution implements two roles represented by job chains:
      • Resource Locks Lock Provider implements a job chain that accepts shadow orders for serialized access to resources. The job chain guarantees that only one order at a time is granted a resource lock. The job chain will suspend orders in originating job chains as long as a resource lock is blocked and will continue such orders if when the resource lock is becomes available. Any number of orders of the same or of different job chains can use the Resource Locks Lock Provider job chain for serialization.
      • Resource Lock Consumer implements a sample job chain that makes use of a resource that can exclusively should be accessed by exclusively by one order at a time.
  • References

Solution

  • Download resource_lockslock_provider.zip
  • Download resource_lock_consumer.zip
  • Extract the archives to the ./config/live folder of your JobScheduler installation.
  • The archive extracts the files to the folders  resource_lock_locks provider and resource_lock_consumer respectively. 
  • You can store the resource_lock_consumer files in any folder as you like, however, if you move the resource_lock files _provider files to some other location then you will have to adjust settings in the resource_lock_consumer objects.

...

Flowchart
chain_resource_lock [label="Job Chain\nimplements\na Resource ManagerLock Provider",fillcolor="orange"]
job_manage_resource_lock [label="Job Manage Resource Lock",fillcolor="lightskyblue"]
resource_lock_available [shape=diamond,label="Resource Lock available?",fillcolor="white"]
 
chain_resource_lock_consumer_1 [label="Job Chain\nimplements a\nResource Lock Consumer",fillcolor="orange"]
job_request_resource_lock_1 [label="Job Request Resource Lock",fillcolor="lightskyblue"]
job_step_1_1 [label="Job Step 1",fillcolor="lightskyblue"]
job_step_1_2 [label="Job Step 2",fillcolor="lightskyblue"]

chain_resource_lock_consumer_2 [label="Job Chain\nimplements a\nResource Lock Consumer",fillcolor="orange"]
job_request_resource_lock_2 [label="Job Request Resource Lock",fillcolor="lightskyblue"]
job_step_2_1 [label="Job Step 1",fillcolor="lightskyblue"]
job_step_2_2 [label="Job Step 2",fillcolor="lightskyblue"]

order_1A [shape="ellipse",label="Order 1A",fillcolor="violet"]
order_1B [shape="ellipse",label="Order 1B",fillcolor="violet"]
order_2A [shape="ellipse",label="Order 2A",fillcolor="violet"]
order_2B [shape="ellipse",label="Order 2B",fillcolor="violet"]

shadow_order_1A [shape="ellipse",label="Shadow Order 1A",fillcolor="violet"]
shadow_order_1B [shape="ellipse",label="Shadow Order 1B",fillcolor="violet"]
shadow_order_2A [shape="ellipse",label="Shadow Order 2A",fillcolor="violet"]
shadow_order_2B [shape="ellipse",label="Shadow Order 2B",fillcolor="violet"]

order_suspend [label="Suspend Original Order",fillcolor="white"]
order_move [label="Move Original Order to Next Job",fillcolor="white"]

chain_resource_lock_consumer_1 -> order_1A
chain_resource_lock_consumer_1 -> order_1B
order_1A -> job_request_resource_lock_1 -> job_step_1_1
order_1B -> job_request_resource_lock_1 -> job_step_1_2
job_request_resource_lock_1 -> shadow_order_1A
job_request_resource_lock_1 -> shadow_order_1B
 
chain_resource_lock_consumer_2 -> order_2A
chain_resource_lock_consumer_2 -> order_2B
order_2A -> job_request_resource_lock_2 -> job_step_2_1
order_2B -> job_request_resource_lock_2 -> job_step_2_2
job_request_resource_lock_2 -> shadow_order_2A
job_request_resource_lock_2 -> shadow_order_2B
 
chain_resource_lock -> shadow_order_1A
chain_resource_lock -> shadow_order_1B
chain_resource_lock -> shadow_order_2A
chain_resource_lock -> shadow_order_2B
shadow_order_1A -> job_manage_resource_lock
shadow_order_1B -> job_manage_resource_lock
shadow_order_2A -> job_manage_resource_lock
shadow_order_2B -> job_manage_resource_lock

job_manage_resource_lock -> resource_lock_available
resource_lock_available -> order_move [label=" yes "]
resource_lock_available -> order_suspend [label=" no "]
order_move -> job_step_1_1 -> job_step_1_2
order_move -> job_step_2_1 -> job_step_2_2

...