-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Added examples for exit handler for step and dag level (#3495)
- Loading branch information
1 parent
bcb3254
commit e244337
Showing
3 changed files
with
149 additions
and
0 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
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,50 @@ | ||
# This example demonstrates a DAG level exit handler that executes at the end of the task | ||
## irrespective of the success, failure, or error of the task. | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: Workflow | ||
metadata: | ||
generateName: exit-hanlder-dag-level- | ||
spec: | ||
entrypoint: main | ||
templates: | ||
- name: main | ||
dag: | ||
tasks: | ||
- name: A | ||
onExit: exit | ||
template: echo | ||
arguments: | ||
parameters: [{name: message, value: A}] | ||
- name: B | ||
dependencies: [A] | ||
onExit: exit | ||
template: echo | ||
arguments: | ||
parameters: [{name: message, value: B}] | ||
- name: C | ||
dependencies: [A] | ||
onExit: exit | ||
template: echo | ||
arguments: | ||
parameters: [{name: message, value: C}] | ||
- name: D | ||
dependencies: [B, C] | ||
onExit: exit | ||
template: echo | ||
arguments: | ||
parameters: [{name: message, value: D}] | ||
|
||
- name: echo | ||
inputs: | ||
parameters: | ||
- name: message | ||
container: | ||
image: docker/whalesay | ||
command: [cowsay] | ||
args: ["{{inputs.parameters.message}}"] | ||
|
||
- name: exit | ||
container: | ||
image: docker/whalesay | ||
command: [cowsay] | ||
args: ["task cleanup"] |
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,41 @@ | ||
# This example demonstrates a steps level exit handler that executes at the end of the step | ||
## irrespective of the success, failure, or error of the step. | ||
apiVersion: argoproj.io/v1alpha1 | ||
kind: Workflow | ||
metadata: | ||
generateName: exit-handler-step-level- | ||
spec: | ||
entrypoint: main | ||
templates: | ||
- name: main | ||
steps: | ||
- - name: hello1 | ||
onExit: exit | ||
template: whalesay | ||
arguments: | ||
parameters: [{name: message, value: "hello1"}] | ||
- - name: hello2a | ||
onExit: exit | ||
template: whalesay | ||
arguments: | ||
parameters: [{name: message, value: "hello2a"}] | ||
- name: hello2b | ||
onExit: exit | ||
template: whalesay | ||
arguments: | ||
parameters: [{name: message, value: "hello2b"}] | ||
|
||
- name: exit | ||
container: | ||
image: docker/whalesay | ||
command: [cowsay] | ||
args: ["step cleanup"] | ||
|
||
- name: whalesay | ||
inputs: | ||
parameters: | ||
- name: message | ||
container: | ||
image: docker/whalesay | ||
command: [cowsay] | ||
args: ["{{inputs.parameters.message}}"] |