-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[2.x engine] Append task run futures only when entering task run engine from flow run context #14439
Merged
[2.x engine] Append task run futures only when entering task run engine from flow run context #14439
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
20940b9
initial commit
serinamarie 7b940d2
lint
serinamarie a917e8d
lint
serinamarie c061157
update implementation
serinamarie 5a46fbd
linting
serinamarie ce8cfa8
dont passed to mapped task
serinamarie 0776184
add a test
serinamarie 7e5c30a
Merge branch '2.x' into fix-14390
zzstoatzz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4226,6 +4226,35 @@ def my_flow(): | |
assert result == "Failed" | ||
assert count == 2 | ||
|
||
def test_nested_task_with_retries_on_outer_task(self): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This unit test looks like what I'd have used to test, so while I didn't test myself if this work then I expect this will resolve teh issue! |
||
""" | ||
Regression test for https://github.com/PrefectHQ/prefect/issues/14390 | ||
where the flow run would be marked as failed despite the tasks eventually succeeding. | ||
""" | ||
|
||
failed = False | ||
|
||
@task | ||
def nested_flaky_task(): | ||
# This task will fail the first time it is run, but will succeed if called a second time | ||
nonlocal failed | ||
if not failed: | ||
failed = True | ||
raise ValueError("Forced task failure") | ||
|
||
@task( | ||
retries=1, | ||
) | ||
def top_task(): | ||
nested_flaky_task() | ||
|
||
@flow | ||
def nested_task_flow(): | ||
top_task() | ||
|
||
result = nested_task_flow() | ||
assert result[0].is_completed() | ||
|
||
def test_nested_task_with_retries_on_inner_and_outer_task(self): | ||
count = 0 | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a prefect dev environment running yet where I can test this locally, but only thing I'd double check is that the nested task run still gets its status correctly tracked in the UI and everything even when it's not appended to this list. Without knowing much about the prefect internals, I don't have good intuition here... If you say it works, I believe you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @thundercat1 - here's how it looks on this branch
using this code
which matches my expectations.