-
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
New Feature: provide failFast flag, allow a DAG to run all branches of the DAG (either success or failure) #1443
Changes from 4 commits
523584f
ed62d15
eab5469
fb7f06c
744107b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: Workflow | ||
metadata: | ||
generateName: dag-primay-branch- | ||
spec: | ||
entrypoint: statis | ||
templates: | ||
- name: a | ||
container: | ||
image: docker/whalesay:latest | ||
command: [cowsay] | ||
args: ["hello world"] | ||
- name: b | ||
retryStrategy: | ||
limit: 2 | ||
container: | ||
image: alpine:latest | ||
command: [sh, -c] | ||
args: ["sleep 30; echo haha"] | ||
- name: c | ||
retryStrategy: | ||
limit: 3 | ||
container: | ||
image: alpine:latest | ||
command: [sh, -c] | ||
args: ["echo intentional failure; exit 2"] | ||
- name: d | ||
container: | ||
image: docker/whalesay:latest | ||
command: [cowsay] | ||
args: ["hello world"] | ||
- name: statis | ||
dag: | ||
failFast: false | ||
tasks: | ||
- name: A | ||
template: a | ||
- name: B | ||
dependencies: [A] | ||
template: b | ||
- name: C | ||
dependencies: [A] | ||
template: c | ||
- name: D | ||
dependencies: [B] | ||
template: d | ||
- name: E | ||
dependencies: [D] | ||
template: d |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
apiVersion: argoproj.io/v1alpha1 | ||
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. Please move this file under test/e2e/expectedfailures since it is expected to fail 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. OK |
||
kind: Workflow | ||
metadata: | ||
generateName: dag-primay-branch- | ||
spec: | ||
entrypoint: statis | ||
templates: | ||
- name: a | ||
container: | ||
image: docker/whalesay:latest | ||
command: [cowsay] | ||
args: ["hello world"] | ||
- name: b | ||
retryStrategy: | ||
limit: 2 | ||
container: | ||
image: alpine:latest | ||
command: [sh, -c] | ||
args: ["sleep 30; echo haha"] | ||
- name: c | ||
retryStrategy: | ||
limit: 3 | ||
container: | ||
image: alpine:latest | ||
command: [sh, -c] | ||
args: ["echo intentional failure; exit 2"] | ||
- name: d | ||
container: | ||
image: docker/whalesay:latest | ||
command: [cowsay] | ||
args: ["hello world"] | ||
- name: statis | ||
dag: | ||
tasks: | ||
- name: A | ||
template: a | ||
- name: B | ||
dependencies: [A] | ||
template: b | ||
- name: C | ||
dependencies: [A] | ||
template: c | ||
- name: D | ||
dependencies: [B] | ||
template: d | ||
- name: E | ||
dependencies: [D] | ||
template: d |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,7 +87,31 @@ func (d *dagContext) assessDAGPhase(targetTasks []string, nodes map[string]wfv1. | |
retriesExhausted = false | ||
} | ||
} | ||
|
||
if unsuccessfulPhase != "" { | ||
if d.tmpl != nil && d.tmpl.DAG != nil { | ||
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. We don't need this check. DAG contexts are always instantiated with a template of type DAG 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. OK |
||
// If failFast set to false, we should return Running to continue this workflow for other DAG branch | ||
if d.tmpl.DAG.FailFast != nil && !*d.tmpl.DAG.FailFast { | ||
tmpOverAllFinished := true | ||
// If all the nodes have finished, we should mark the failed node to finish overall workflow | ||
// So we should check all the targetTasks have finished | ||
for _, tmpDepName := range targetTasks { | ||
tmpDepNode := d.getTaskNode(tmpDepName) | ||
if tmpDepNode == nil { | ||
tmpOverAllFinished = false | ||
break | ||
} | ||
if tmpDepNode.Type == wfv1.NodeTypeRetry && hasMoreRetries(tmpDepNode, d.wf) { | ||
tmpOverAllFinished = false | ||
break | ||
} | ||
} | ||
if !tmpOverAllFinished { | ||
return wfv1.NodeRunning | ||
} | ||
} | ||
} | ||
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. Do you mind writing a unit test for this? 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. sure |
||
|
||
// if we were unsuccessful, we can return *only* if all retry nodes have ben exhausted. | ||
if retriesExhausted { | ||
return unsuccessfulPhase | ||
|
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.
Please move this file under test/e2e/expectedfailures since it is expected to fail
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.
OK