Conversation
|
|
| return f"unlock-event-{sender_workflow_id}" | ||
|
|
||
|
|
||
| @workflow.defn |
There was a problem hiding this comment.
I think we may not want to blind-port this from Go but have a more Pythonic way to do a mutex and we want to make sure workflows are in their own files separate from activities/models. For instance, the .NET version of this sample at https://github.com/temporalio/samples-dotnet/tree/main/src/Mutex made an idiomatic WorkflowMutex class for general purpose use. I think this sample should consider a workflow-backed Lock class that looks almost exactly like https://docs.python.org/3/library/asyncio-sync.html#asyncio.Lock and is copyable/usable as if it is a library.
What was changed
Added a python sample for mutex pattern
Why?
The sample exists for go sdk but not for python yet. I needed it so I figured I could share it.
Checklist
I’ve left a TODO in the code, I am not sure how to properly distinguish who sends a release in python (even if sender workflows are supposed to send them in order)
ran it locally with latest temporal dev server, and using branch pyproject.toml configuration.
not that I think of