Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a sample that uses a workflow to lock resources #172

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

nagl-temporal
Copy link

@nagl-temporal nagl-temporal commented Apr 1, 2025

What was changed

Adds a new sample that demonstrates how to use a workflow to mediate access to a small pool of resources.

Why?

A customer asked for an example of how to do this kind of thing. We ruled out worker-specific task queues and sessions - those work best when you can run the worker in/near the protected resource. They cannot, for security reasons, which leaves us with:

  • non-temporal approaches to resource locking, or
  • something like this

Checklist

  1. How was this tested:
    Ran the worker and starter per the readme.

  2. Any docs updates needed?
    No - it's just a sample.

@CLAassistant
Copy link

CLAassistant commented Apr 1, 2025

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@cretz
Copy link
Member

cretz commented Apr 2, 2025

There is a pattern for doing this with signal-with-start. You can see a sample in .NET, Go, and TypeScript.

Would totally support such a sample in Python. Needs to be a simple Lock class usable in a workflow with similar semantics to https://docs.python.org/3/library/asyncio-sync.html#asyncio.Lock but does signal with start and such. Also make sure we have a test or two. Feel free to adapt this PR (or close it and I can make an issue tracking that we need such a sample).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants