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

acquire/release token on TaskWorker without errors #14084

Merged
merged 6 commits into from
Jun 17, 2024

Conversation

jakekaplan
Copy link
Contributor

@jakekaplan jakekaplan commented Jun 17, 2024

When acquiring or releasing a token we need to be sure to not propagate RuntimeErrors so that the TaskWorker keeps running.

@jakekaplan jakekaplan changed the title acquire in try-except acquire token in try-except Jun 17, 2024
@jakekaplan jakekaplan changed the title acquire token in try-except acquire/release token on TaskWorker without errors Jun 17, 2024
@jakekaplan jakekaplan marked this pull request as ready for review June 17, 2024 18:54
@jakekaplan jakekaplan requested a review from a team as a code owner June 17, 2024 18:54
Copy link
Member

@desertaxle desertaxle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a test for this? Submitting the same task run twice via execute_task_run should give us the confidence we need.

@jakekaplan
Copy link
Contributor Author

jakekaplan commented Jun 17, 2024

Can you add a test for this? Submitting the same task run twice via execute_task_run should give us the confidence we need.

Added! Let me know if its not what you had in mind

async with task_worker:
await asyncio.gather(
task_worker.execute_task_run(task_run),
task_worker.execute_task_run(task_run),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On main this errors with this borrower is already holding one of this CapacityLimiter's tokens

Copy link
Member

@desertaxle desertaxle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@jakekaplan jakekaplan merged commit d71cf8a into main Jun 17, 2024
26 checks passed
@jakekaplan jakekaplan deleted the move-acquire-into-safe-submit branch June 17, 2024 20:48
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.

None yet

2 participants