fix: schedule lifecycle hooks for non-leaf DAG tasks on failure. Fixes #16057#16058
Open
fcolombo7 wants to merge 1 commit intoargoproj:mainfrom
Open
fix: schedule lifecycle hooks for non-leaf DAG tasks on failure. Fixes #16057#16058fcolombo7 wants to merge 1 commit intoargoproj:mainfrom
fcolombo7 wants to merge 1 commit intoargoproj:mainfrom
Conversation
…sks. Fixes argoproj#16057 Signed-off-by: fcolombo7 <colombofilippo.fc@gmail.com>
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.
Fixes #16057
Motivation
When a non-leaf DAG task (one whose template is itself a DAG or steps) fails, its lifecycle hooks are never scheduled if the failure causes downstream tasks to be marked
Omitted.The root cause: hook evaluation in
executeDAGTaskruns at the top of the function while the node is stillRunning. For non-leaf tasks, the phase transitionRunning → Failedhappens later insideexecuteTemplate. By then hook evaluation has already passed and no further sweep is triggered for that task, so the hook is permanently lost.Leaf tasks (bare container pods) are unaffected because their phase is updated by
podReconciliationbeforeexecuteDAGTaskruns.Modifications
Merged the post-
executeTemplatehook re-evaluation into the existingif node.Completed()block at the bottom ofexecuteDAGTask's inner loop. Hooks are evaluated first; if not yet complete the function returns early, blocking theOmitcascade via the existingCheckAllHooksFullfilledgate inevaluateDependsLogic.Once fulfilled,
runOnExitNodeproceeds as before.Verification
Added two regression tests to
dag_test.gousing nested inner DAG templates (required to reproduce; bare container tasks are reconciled beforeexecuteDAGTaskruns):TestDAGHookNonLeafSerialHeadFails: non-leaf task fails with one downstream dependentTestDAGHookNonLeafFanInBothFail: two parallel non-leaf tasks both fail with a shared downstreamgo test ./workflow/controller/ -run TestDAGHookNonLeafpasses. Fullgo test ./workflow/controller/passes with no regressions.Documentation
No documentation change needed.
AI
Claude (Anthropic) was used to navigate and understand the codebase, identify the root cause, and assist in writing the fix and regression tests. All code was reviewed and validated by the author per the Argo project Generative AI policy.