-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
fix: OnExit node can retry when retry a workflow (#13184) #13185
base: main
Are you sure you want to change the base?
Conversation
c047df0
to
1b58b6e
Compare
what if there are multiple onExit nodes? |
The logic of multiple onExit nodes and one onExit node is the same, no mater parent node status, the onExit node will be retried There are two types of failed parent nodes that can be retried:
|
Can you try this workflow: apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
name: workflow-exit-handler-demo
spec:
entrypoint: main
onExit: exit-handler
templates:
- name: main
steps:
- - name: fail
template: fail
- name: exit-handler
steps:
- - name: alarm
template: alarm
- name: alarm
container:
image: alpine:3.18
command: [sh, -c]
args: ["echo alarm"]
- name: fail
container:
image: alpine:3.18
command: [sh, -c]
args: ["exit 1"] Can step |
@jswxstw Thank you very much for the example, I found that the alarm was not re-executed after I performed a retry, based on this example I re-modified the code logic, see the latest code submission for details |
1b58b6e
to
374bcdb
Compare
There is already a function to determine whether or not node run as exit handler. You should consider using it directly. argo-workflows/pkg/apis/workflow/v1alpha1/workflow_types.go Lines 2384 to 2387 in ac9cb3a
However, this function has a bug now: the |
@jswxstw The function you provided is great, I will modify the code based on it, thanks Review your change: All children of onExit are also added with the So |
Good question. DAG do have the same bug.
Good idea! But |
boundaryID is parent group node just like this function argo-workflows/workflow/util/util.go Line 815 in ac9cb3a
|
#13016 add a new function // IsPartOfExitHandler returns whether node is part of exit handler.
func (woc *wfOperationCtx) IsPartOfExitHandler(node wfv1.NodeStatus) bool {
if node.BoundaryID == "" {
return node.IsExitNode()
}
if boundaryNode, err := woc.wf.Status.Nodes.Get(node.BoundaryID); err == nil {
return boundaryNode.IsExitNode()
}
return false
} |
Signed-off-by: Goober <[email protected]>
Signed-off-by: Goober <[email protected]>
374bcdb
to
7c9195b
Compare
Fixes #13184
Motivation
fix retry logic
Modifications
FormulateRetryWorkflow
inworkflow/util/util.go
fileisDescendantNodeSucceeded
inworkflow/util/util.go
fileVerification
OnExit node and its parent can be retried when a workflow is retried
yaml:
test/e2e/testdata/retry-workflow-with-continueon.yaml