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

Cancel state #1758

Merged
merged 11 commits into from
Nov 21, 2019
Merged

Cancel state #1758

merged 11 commits into from
Nov 21, 2019

Conversation

cicdw
Copy link
Member

@cicdw cicdw commented Nov 20, 2019

Thanks for contributing to Prefect!

Please describe your work and make sure your PR:

  • adds new tests (if appropriate)
  • updates CHANGELOG.md (if appropriate)
  • updates docstrings for any new functions or function arguments, including docs/outline.toml for API reference docs (if appropriate)

Note that your PR will not be reviewed unless all three boxes are checked.

What does this PR change?

This PR:

  • renames Aborted state Cancelled
  • introduces graceful translation of KeyboardInterrupts to Cancelled states when running Flows in Core
  • introduces heartbeat check in Cloud to look for cancelled flow runs and respond via cancelled states / termination of execution

Why is this PR important?

Core users will immediately see the benefit of CTRL+C when running flow.run, and this will soon enable the ability to cancel flow runs from the UI once the new state serializers have made their way to Prod.

@codecov
Copy link

codecov bot commented Nov 20, 2019

Codecov Report

Merging #1758 into master will decrease coverage by 0.1%.
The diff coverage is 51.92%.

joshmeek
joshmeek previously approved these changes Nov 20, 2019
Copy link

@joshmeek joshmeek left a comment

Choose a reason for hiding this comment

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

🚀

@joshmeek joshmeek dismissed their stale review November 20, 2019 22:58

I reject my review because I'm not sure if it should be Cancelled or Canceled

Copy link
Member

@jlowin jlowin left a comment

Choose a reason for hiding this comment

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

Do cancelled states result in downstream triggerfails or possibly downstream runs if they have on failed triggers? Should a cancelled task not be followed by any task runs?

(Not a leading question, just asking. I can imagine cancelling a task and WANTING downstream cleanups to run)

@cicdw
Copy link
Member Author

cicdw commented Nov 21, 2019

Great question @jlowin - because we will only support cancellation of at the Flow Run level, downstream tasks will never be able to enter a Running state. This is because once the Flow Run enters a Cancelled state, all heartbeats will fail / raise errors in the main thread. Moreover, once we implement version locking with Flow Run versions as well, downstream tasks won't even be able to change their state as their flow run state version will be out-of-date.

However, there is the potential for some inefficiency when running with Dask - whenever the Flow Run process raises the KeyboardInterrupt, Dask will detect that and "cancel" all Futures associated with that client. I found that in practice all those futures still ran, meaning the very initial task runner pipeline steps will still run for all tasks, but they will never be able to actually update the task run's state.

@jlowin
Copy link
Member

jlowin commented Nov 21, 2019

Ah, thanks for clearing that up for me.

@cicdw cicdw merged commit e6db2b3 into master Nov 21, 2019
@cicdw cicdw deleted the cancel-state branch November 21, 2019 18:14
joshmeek added a commit that referenced this pull request Nov 22, 2019
zanieb added a commit that referenced this pull request May 12, 2022
…ker/metadata-action-4

Bump docker/metadata-action from 3 to 4
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