Skip to content

Commit 9a56f48

Browse files
authored
Error and Retry handling update (#435) (#445)
* [WIP] Error and Retry handling update Signed-off-by: Tihomir Surdilovic <[email protected]> * updated to spec text and all examples Signed-off-by: Tihomir Surdilovic <[email protected]> * update per todays discussion Signed-off-by: Tihomir Surdilovic <[email protected]>
1 parent 37d70f5 commit 9a56f48

11 files changed

+847
-519
lines changed

comparisons/comparison-argo.md

Lines changed: 60 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -683,10 +683,6 @@ states:
683683
arguments:
684684
args:
685685
- import random; import sys; exit_code = random.choice([0, 1, 1]); sys.exit(exit_code)
686-
onErrors:
687-
- error: "*"
688-
retryRef: All workflow errors retry strategy
689-
end: true
690686
end: true
691687
```
692688
@@ -862,62 +858,69 @@ id: exit-handlers-
862858
name: Exit/Error Handling Example
863859
version: '1.0'
864860
specVersion: '0.7'
861+
autoRetries: true
865862
start: intentional-fail-state
866863
functions:
867-
- name: intentional-fail-function
868-
metadata:
869-
image: alpine:latest
870-
command: "[sh, -c]"
871-
- name: send-email-function
872-
metadata:
873-
image: alpine:latest
874-
command: "[sh, -c]"
875-
- name: celebrate-cry-function
876-
metadata:
877-
image: alpine:latest
878-
command: "[sh, -c]"
864+
- name: intentional-fail-function
865+
metadata:
866+
image: alpine:latest
867+
command: "[sh, -c]"
868+
- name: send-email-function
869+
metadata:
870+
image: alpine:latest
871+
command: "[sh, -c]"
872+
- name: celebrate-cry-function
873+
metadata:
874+
image: alpine:latest
875+
command: "[sh, -c]"
876+
errors:
877+
- name: IntentionalError
878+
code: '404'
879879
states:
880-
- name: intentional-fail-state
881-
type: operation
882-
actions:
883-
- functionRef:
884-
refName: intentional-fail-function
885-
arguments:
886-
args: echo intentional failure; exit 1
887-
onErrors:
888-
- error: "*"
889-
transition: send-email-state
890-
- name: send-email-state
891-
type: operation
892-
actions:
893-
- functionRef:
894-
refName: send-email-function
895-
arguments:
896-
args: "echo send e-mail: ${ .workflow.name } ${ .workflow.status }"
897-
transition: emo-state
898-
- name: emo-state
899-
type: switch
900-
dataConditions:
901-
- condition: "${ .workflow| .status == \"Succeeded\" }"
902-
transition: celebrate-state
903-
- condition: "${ .workflow| .status != \"Succeeded\" }"
904-
transition: cry-state
905-
- name: celebrate-state
906-
type: operation
907-
actions:
908-
- functionRef:
909-
refName: celebrate-cry-function
910-
arguments:
911-
args: echo hooray!
912-
end: true
913-
- name: cry-state
914-
type: operation
915-
actions:
916-
- functionRef:
917-
refName: celebrate-cry-function
918-
arguments:
919-
args: echo boohoo!
920-
end: true
880+
- name: intentional-fail-state
881+
type: operation
882+
actions:
883+
- functionRef:
884+
refName: intentional-fail-function
885+
arguments:
886+
args: echo intentional failure; exit 1
887+
nonRetryableErrors:
888+
- IntentionalError
889+
onErrors:
890+
- errorRef: IntentionalError
891+
transition: send-email-state
892+
end: true
893+
- name: send-email-state
894+
type: operation
895+
actions:
896+
- functionRef:
897+
refName: send-email-function
898+
arguments:
899+
args: 'echo send e-mail: ${ .workflow.name } ${ .workflow.status }'
900+
transition: emo-state
901+
- name: emo-state
902+
type: switch
903+
dataConditions:
904+
- condition: ${ .workflow| .status == "Succeeded" }
905+
transition: celebrate-state
906+
- condition: ${ .workflow| .status != "Succeeded" }
907+
transition: cry-state
908+
- name: celebrate-state
909+
type: operation
910+
actions:
911+
- functionRef:
912+
refName: celebrate-cry-function
913+
arguments:
914+
args: echo hooray!
915+
end: true
916+
- name: cry-state
917+
type: operation
918+
actions:
919+
- functionRef:
920+
refName: celebrate-cry-function
921+
arguments:
922+
args: echo boohoo!
923+
end: true
921924
```
922925
923926
</td>

comparisons/comparison-bpmn.md

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -200,42 +200,49 @@ functions:
200200
<td valign="top">
201201
202202
```yaml
203+
---
203204
id: errorwithretries
204205
name: Error Handling With Retries Workflow
205206
version: '1.0'
206207
specVersion: '0.7'
207208
start: Make Coffee
208209
states:
209-
- name: Make Coffee
210-
type: operation
211-
actions:
212-
- functionRef: makeCoffee
213-
transition: Add Milk
214-
- name: Add Milk
215-
type: operation
216-
actions:
217-
- functionRef: addMilk
218-
onErrors:
219-
- error: D'oh! No more Milk!
220-
retryRef: noMilkRetries
210+
- name: Make Coffee
211+
type: operation
212+
actions:
213+
- functionRef: makeCoffee
214+
transition: Add Milk
215+
- name: Add Milk
216+
type: operation
217+
actions:
218+
- functionRef: addMilk
219+
retryRef: noMilkRetries
220+
retryableErrors:
221+
- D'oh! No more Milk!
222+
onErrors:
223+
- errorRef: D'oh! No more Milk!
224+
end: true
225+
transition: Drink Coffee
226+
- name: Drink Coffee
227+
type: operation
228+
actions:
229+
- functionRef: drinkCoffee
221230
end: true
222-
transition: Drink Coffee
223-
- name: Drink Coffee
224-
type: operation
225-
actions:
226-
- functionRef: drinkCoffee
227-
end: true
228231
retries:
229-
- name: noMilkRetries
230-
delay: PT1M
231-
maxAttempts: 10
232+
- name: noMilkRetries
233+
delay: PT1M
234+
maxAttempts: 10
235+
errors:
236+
- name: D'oh! No more Milk!
237+
code: '123'
232238
functions:
233-
- name: makeCoffee
234-
operation: file://myservice.json#make
235-
- name: addMilk
236-
operation: file://myservice.json#add
237-
- name: drinkCoffee
238-
operation: file://myservice.json#drink
239+
- name: makeCoffee
240+
operation: file://myservice.json#make
241+
- name: addMilk
242+
operation: file://myservice.json#add
243+
- name: drinkCoffee
244+
operation: file://myservice.json#drink
245+
239246
```
240247

241248
</td>

comparisons/comparison-brigade.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,17 +146,22 @@ id: greetingwitherrorcheck
146146
name: Greeting Workflow With Error Check
147147
version: '1.0'
148148
specVersion: '0.7'
149+
autoRetries: true
149150
start: GreetingState
150151
events:
151152
- name: execEvent
152153
type: exec
154+
errors:
155+
- name: CommonError
156+
code: '123'
153157
functions:
154158
- name: greetingFunction
155159
metadata:
156160
image: alpine:3.7
157161
command: echo
158162
- name: consoleLogFunction
159-
type: console
163+
metadata:
164+
type: console
160165
states:
161166
- name: GreetingState
162167
type: event
@@ -169,18 +174,24 @@ states:
169174
refName: greetingFunction
170175
arguments:
171176
greeting: hello
177+
nonRetryableErrors:
178+
- CommonError
172179
- name: sayGoodbyeAction
173180
functionRef:
174181
refName: greetingFunction
175182
arguments:
176183
greeting: hello
184+
nonRetryableErrors:
185+
- CommonError
177186
- name: logDoneAction
178187
functionRef:
179188
refName: consoleLogFunction
180189
arguments:
181190
log: done
191+
nonRetryableErrors:
192+
- CommonError
182193
onErrors:
183-
- error: "*"
194+
- errorRef: CommonError
184195
transition: HandleErrorState
185196
end: true
186197
- name: HandleErrorState
@@ -190,7 +201,7 @@ states:
190201
functionRef:
191202
refName: consoleLogFunction
192203
arguments:
193-
log: "Caught Exception ${ .exception }"
204+
log: Caught Exception ${ .exception }
194205
end: true
195206
```
196207

0 commit comments

Comments
 (0)