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

Implment blocking pause/resume for flows #7637

Merged
merged 19 commits into from Nov 28, 2022
Merged

Conversation

anticorrelator
Copy link
Contributor

Starts work on #7410

This PR introduces the semantics necessary to pause a flow and allow it to be resumed out-of-process.

from prefect import task, flow, pause, resume

@task
def foo():
    return 42

@flow
def bar():
    x = foo()
    pause()
    return x + foo()
    
bar()  # execution is blocked until resumed
resume(BAR_FLOW_RUN_ID)  # when called out of process, resumes flow execution
> 84

Checklist

  • This pull request references any related issue by including "closes <link to issue>"
    • If no issue exists and your change is not a small fix, please create an issue first.
  • This pull request includes tests or only affects documentation.
  • This pull request includes a label categorizing the change e.g. fix, feature, enhancement

@netlify
Copy link

netlify bot commented Nov 23, 2022

Deploy Preview for prefect-orion ready!

Name Link
🔨 Latest commit 4140077
🔍 Latest deploy log https://app.netlify.com/sites/prefect-orion/deploys/6384d6e5617f23000925b1a3
😎 Deploy Preview https://deploy-preview-7637--prefect-orion.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link
Collaborator

@zangell44 zangell44 left a comment

Choose a reason for hiding this comment

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

Looks clean to me!

For Postgres, I think we'll need an extra migration to add Paused to the enum value. Something like ALTER TYPE state_type ADD VALUE 'Paused'.

@zanieb
Copy link
Contributor

zanieb commented Nov 23, 2022

Should we consider more verbose function names? e.g. pause_flow_run, resume_flow_run? We can always expose them as these simpler options later, but it seems safer to be explicit to start.

@anticorrelator
Copy link
Contributor Author

Should we consider more verbose function names? e.g. pause_flow_run, resume_flow_run? We can always expose them as these simpler options later, but it seems safer to be explicit to start.

I like this idea

@anticorrelator anticorrelator merged commit 0fbceb4 into main Nov 28, 2022
@anticorrelator anticorrelator deleted the blocking-pause-resume branch November 28, 2022 16:06
@zanieb
Copy link
Contributor

zanieb commented Nov 28, 2022

@anticorrelator, not a big deal but please try to have titles be appropriate for the changelog so it doesn't need to be edited on release.

@anticorrelator anticorrelator changed the title Blocking pause/resume Implment blocking pause/resume for flows Nov 28, 2022
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.

None yet

3 participants