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

submitted state lock #291

Merged
merged 6 commits into from
Sep 23, 2021
Merged

submitted state lock #291

merged 6 commits into from
Sep 23, 2021

Conversation

jakekaplan
Copy link
Contributor

@jakekaplan jakekaplan commented Sep 20, 2021

Summary

Adds an in memory in process submitted state lock. Closes #203

Importance

Currently it is possible for multiple agents to pick up the same scheduled flow_run, this enables a buffer so that if multiple agents try to run the same flow_run only one will succeed.

Checklist

This PR:

  • adds new tests (if appropriate)
  • adds a change file in the changes/ directory (if appropriate)

@github-actions github-actions bot added the API label Sep 20, 2021
@jakekaplan jakekaplan requested a review from cicdw September 20, 2021 21:05
@jakekaplan jakekaplan marked this pull request as ready for review September 20, 2021 21:05
Copy link
Member

@cicdw cicdw left a comment

Choose a reason for hiding this comment

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

A question about timeouts for acquiring the lock; also if you include "Closes #203" in the main PR description GitHub will auto-close the issue

Otherwise this looks clean and robust, nice work!

src/prefect_server/utilities/collections.py Show resolved Hide resolved
src/prefect_server/utilities/collections.py Outdated Show resolved Hide resolved
src/prefect_server/utilities/collections.py Show resolved Hide resolved
src/prefect_server/utilities/collections.py Outdated Show resolved Hide resolved
src/prefect_server/utilities/collections.py Outdated Show resolved Hide resolved
src/prefect_server/utilities/collections.py Outdated Show resolved Hide resolved
Copy link
Member

@cicdw cicdw left a comment

Choose a reason for hiding this comment

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

@jakekaplan this LGTM but would you also mind adding a test at the GraphQL layer within tests/graphql/test_states.py that replicates the API level test at a higher level ?

@jakekaplan
Copy link
Contributor Author

@cicdw added the graphql test 👍

@cicdw cicdw merged commit 139f39f into master Sep 23, 2021
@cicdw cicdw deleted the submitted-state-lock branch September 23, 2021 16:24
@zanieb zanieb mentioned this pull request Oct 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add submitted state locking to Prefect Server
3 participants