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 allow_failure annotation to allow failed runs to be passed downstream #7120

Merged
merged 3 commits into from
Oct 12, 2022

Conversation

zanieb
Copy link
Contributor

@zanieb zanieb commented Oct 10, 2022

Closes #7098

Example

@task
def fails():
    raise ValueError("Fail task!")

@task
def bar(y):
    return y

@flow
def test_flow():
    f = fails.submit()

    # Previously, `bar` would fail with a `NotReady` state
    # Now, it will receive an exception
    b = bar.submit(allow_failure(f))
    assert isinstance(b.result(), ValueError)
    
    # Previously, `bar` would fail with a `NotReady` state
    # Now, it will run after the upstream completes
    b = bar.submit(1, wait_for=[allow_failure(f)])
    assert b.result() == 1

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 Oct 10, 2022

Deploy Preview for prefect-orion ready!

Name Link
🔨 Latest commit 8aa1d36
🔍 Latest deploy log https://app.netlify.com/sites/prefect-orion/deploys/63457da774442d0008c3614f
😎 Deploy Preview https://deploy-preview-7120--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.

@zanieb zanieb added the enhancement An improvement of an existing feature label Oct 10, 2022
@zanieb zanieb marked this pull request as ready for review October 10, 2022 18:03
@zanieb zanieb requested a review from cicdw as a code owner October 10, 2022 18:03
@zanieb zanieb requested review from bunchesofdonald and EmilRex and removed request for cicdw October 10, 2022 18:03
@zanieb
Copy link
Contributor Author

zanieb commented Oct 10, 2022

I'd like to add some documentation before merging, but otherwise this is pretty straightforward.

Copy link
Contributor

@EmilRex EmilRex left a comment

Choose a reason for hiding this comment

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

🚀

@zanieb
Copy link
Contributor Author

zanieb commented Oct 11, 2022

@tpdorsey do you know where documentation would best fit for this?

@tpdorsey
Copy link
Contributor

@madkinsz I think Tasks is the right place for this

Wrapper for iterables.

Indicates that this input should be sent as-is to all runs created during a mapping
operation instead of being split.
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for updating this.

@zanieb
Copy link
Contributor Author

zanieb commented Oct 12, 2022

There's no wait_for documentation right now. I can write it but I'd like to get this merged and do it as a follow-up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An improvement of an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow tasks to wait_for any terminal state, not just Completed
5 participants