Exit Actions#
See also
For a full list of exit codes, see Exit Codes.
You can define task actions based on the exit code for every task in a workflow. Supported actions are:
Action |
Description |
|---|---|
COMPLETE |
Task will be marked as COMPLETED. |
FAIL |
Task will be marked as FAILED. |
RESCHEDULE |
Task will be marked as RESCHEDULED and the same task with an incremented retry ID
will be scheduled. If you want all other tasks in the same group to be restarted,
please set |
Note
The default configuration for exit actions are to mark the task as COMPLETED when the exit
code is 0. If the task is preempted, mark the task as RESCHEDULED.
Otherwise, mark the task as FAIL.
An example of how you can define exit actions is shown in the following example.
Exit codes have the format as start1-end1,num2,....
workflow:
name: exit-actions-example
tasks:
- name: example
image: ubuntu
command: [/bin/sh]
args: [/tmp/run.sh]
files:
- contents: |
echo hello
exit 16
path: /tmp/run.sh
exitActions:
COMPLETE: 0,1-10,16,20 # (1)
The task will be marked as
COMPLETEDwhen the exit code is0, between1-10(inclusive),16, or20.
The task above will return exit code as 16 and based on the actions the task will have status
as COMPLETED.
Note
Make sure there is no overlapping between exit codes for different actions.
Exit codes generated by the task should be no greater than
255as higher exit codes are reserved for OSMO.
The following example shows how user can reschedule a task based on its exit codes.
workflow:
name: exit-actions-example
tasks:
- name: example
image: ubuntu
command: [/bin/sh]
args: [/tmp/run.sh]
files:
- contents: |
echo hello
exit 16
path: /tmp/run.sh
exitActions:
COMPLETE: 0-10
RESCHEDULE: 11-20 # (1)
The task will be marked as
RESCHEDULEDsince the exit code is 16 and it falls into the range11-20.
You can access details about rescheduled tasks by setting the verbose flag:
$ osmo workflow query <workflow_id> --verbose