-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support nested steps workflow parallelism (#1046)
- Loading branch information
1 parent
eb48c23
commit f2914d6
Showing
3 changed files
with
172 additions
and
6 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# Example on specifying parallelism on the outer DAG and limiting the number of its | ||
# children DAGs to be run at the same time. | ||
# | ||
# As the parallelism of A is 2, only two of the three DAGs (b2, b3, b4) will start | ||
# running after b1 is finished, and the left DAG will run after either one is finished. | ||
|
||
apiVersion: argoproj.io/v1alpha1 | ||
kind: Workflow | ||
metadata: | ||
generateName: parallelism-nested-dag- | ||
spec: | ||
entrypoint: A | ||
templates: | ||
- name: A | ||
parallelism: 2 | ||
dag: | ||
tasks: | ||
- name: b1 | ||
template: B | ||
arguments: | ||
parameters: | ||
- name: msg | ||
value: "1" | ||
- name: b2 | ||
template: B | ||
dependencies: [b1] | ||
arguments: | ||
parameters: | ||
- name: msg | ||
value: "2" | ||
- name: b3 | ||
template: B | ||
dependencies: [b1] | ||
arguments: | ||
parameters: | ||
- name: msg | ||
value: "3" | ||
- name: b4 | ||
template: B | ||
dependencies: [b1] | ||
arguments: | ||
parameters: | ||
- name: msg | ||
value: "4" | ||
- name: b5 | ||
template: B | ||
dependencies: [b2, b3, b4] | ||
arguments: | ||
parameters: | ||
- name: msg | ||
value: "5" | ||
|
||
- name: B | ||
inputs: | ||
parameters: | ||
- name: msg | ||
dag: | ||
tasks: | ||
- name: c1 | ||
template: one-job | ||
arguments: | ||
parameters: | ||
- name: msg | ||
value: "{{inputs.parameters.msg}} c1" | ||
- name: c2 | ||
template: one-job | ||
dependencies: [c1] | ||
arguments: | ||
parameters: | ||
- name: msg | ||
value: "{{inputs.parameters.msg}} c2" | ||
- name: c3 | ||
template: one-job | ||
dependencies: [c1] | ||
arguments: | ||
parameters: | ||
- name: msg | ||
value: "{{inputs.parameters.msg}} c3" | ||
|
||
- name: one-job | ||
inputs: | ||
parameters: | ||
- name: msg | ||
container: | ||
image: alpine | ||
command: ['/bin/sh', '-c'] | ||
args: ["echo {{inputs.parameters.msg}}; sleep 10"] |
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Example on specifying parallelism on the outer workflow and limiting the number of its | ||
# children workflowss to be run at the same time. | ||
# | ||
# As the parallelism of A is 1, the four steps of seq-step will run sequentially. | ||
|
||
apiVersion: argoproj.io/v1alpha1 | ||
kind: Workflow | ||
metadata: | ||
generateName: parallelism-nested-workflow- | ||
spec: | ||
arguments: | ||
parameters: | ||
- name: seq-list | ||
value: | | ||
["a","b","c","d"] | ||
entrypoint: A | ||
templates: | ||
- name: A | ||
parallelism: 1 | ||
inputs: | ||
parameters: | ||
- name: seq-list | ||
steps: | ||
- - name: seq-step | ||
template: B | ||
arguments: | ||
parameters: | ||
- name: seq-id | ||
value: "{{item}}" | ||
withParam: "{{inputs.parameters.seq-list}}" | ||
|
||
- name: B | ||
inputs: | ||
parameters: | ||
- name: seq-id | ||
steps: | ||
- - name: jobs | ||
template: one-job | ||
arguments: | ||
parameters: | ||
- name: seq-id | ||
value: "{{inputs.parameters.seq-id}}" | ||
withParam: "[1, 2]" | ||
|
||
- name: one-job | ||
inputs: | ||
parameters: | ||
- name: seq-id | ||
container: | ||
image: alpine | ||
command: ['/bin/sh', '-c'] | ||
args: ["echo {{inputs.parameters.seq-id}}; sleep 30"] |
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