File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change 11# Resource Locking Sample
22
3- This sample shows how to use a long-lived ` LockManagerWorkflow ` to ensure that each ` resource ` is used by at most one
4- ` ResourceLockingWorkflow ` at a time. ` ResourceLockingWorkflow ` runs several activities while it has ownership of a
5- resource.
3+ This sample shows how to use a long-lived ` LockManagerWorkflow ` to allocate ` resources ` to ` ResourceLockingWorkflows ` .
4+ Each ` ResourceLockingWorkflow ` runs several activities while it has ownership of a resource. Note that
5+ ` LockManagerWorkflow ` is making resource allocation decisions based on in-memory state .
66
77Run the following from this directory to start the worker:
88
9- poetry run python worker.py
9+ uv run worker.py
1010
11- This will start the worker. Then, in another terminal, run the following to execute several load workflows:
11+ This will start the worker. Then, in another terminal, run the following to execute several ` ResourceLockingWorkflows ` .
1212
13- poetry run python starter.py
13+ uv run starter.py
1414
1515You should see output indicating that the LockManagerWorkflow serialized access to each resource.
1616
@@ -36,6 +36,7 @@ signals. Locking carries a risk where failure to unlock permanently removing a r
3636Temporal's durable execution guarantees, this can only happen if:
3737
3838- A LoadWorkflow times out (prohibited in the sample code)
39+ - An operator terminates a LoadWorkflow. (Temporal recommends canceling workflows instead of terminating them whenever possible.)
3940- You shut down your workers and never restart them (unhandled, but irrelevant)
4041
4142If a leak were to happen, you could discover the identity of the leaker using the query above, then:
You can’t perform that action at this time.
0 commit comments