fix: ProcessPoolTaskRunner now checks upstream task states in wait_for dependencies#21122
Draft
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
Draft
fix: ProcessPoolTaskRunner now checks upstream task states in wait_for dependencies#21122devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
Conversation
…r dependencies Previously, _resolve_futures_and_submit called wait() on wait_for futures but discarded their states by passing wait_for=None to the subprocess. This meant the subprocess task engine never ran _wait_for_dependencies, so failed upstream tasks were silently ignored and the downstream task would execute instead of being set to NotReady. The fix extracts the terminal State from each waited future and passes those states (which are picklable, unlike futures) to the subprocess. The task engine's _wait_for_dependencies -> resolve_to_final_result already handles State objects, correctly raising UpstreamTaskError for non-completed upstreams, which sets the downstream task to NotReady. Closes #21117 Co-authored-by: alex.s <alex.s> Co-Authored-By: unknown <>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes a bug where
ProcessPoolTaskRunnersilently ignored upstream task failures inwait_fordependencies. Downstream tasks would execute even when their upstream dependencies had failed, instead of being set toNotReadyasThreadPoolTaskRunnercorrectly does.Closes #21117
Root cause
_resolve_futures_and_submitcalledwait()onwait_forfutures but then passedwait_for=Noneto the subprocess, so the subprocess task engine's_wait_for_dependencieswas never invoked to check upstream states.Fix
After waiting for futures to complete, extract their terminal
Stateobjects and pass them aswait_forto the subprocess.Stateobjects are picklable (unlike futures) and the existing task engine machinery (_wait_for_dependencies→resolve_to_final_result) already handlesStateobjects — raisingUpstreamTaskErrorfor non-completed upstreams, which results in theNotReadystate.Important review notes
State(Pydantic model) surviving cloudpickle serialization to the subprocess. This should be fine but is worth verifying.allow_failureannotations: Ifwait_foritems are wrapped inallow_failure(), the annotation is not preserved through the state extraction. However, this edge case was already broken before this PR (the existingwait(list(wait_for))call would fail onallow_failure-wrapped items). Fixing that is out of scope.Checklist
<link to issue>"mint.json.Links