Learn how to execute code in response to entering states in your workflows.
Type | Flow | Task | Description |
---|---|---|---|
on_completion | ✓ | ✓ | Executes when a flow or task run enters a Completed state. |
on_failure | ✓ | ✓ | Executes when a flow or task run enters a Failed state. |
on_cancellation | ✓ | - | Executes when a flow run enters a Cancelling state. |
on_crashed | ✓ | - | Executes when a flow run enters a Crashed state. |
on_running | ✓ | - | Executes when a flow run enters a Running state. |
on_rollback
hook for tasks is not a proper state change hook but instead
is a transaction lifecycle hook.
Rollback hooks accept one argument representing the transaction for the task.on_failure
hook.
on_failure
hook will not run until all retries
have completed and the flow run enters a Failed
state.
kwargs
to state change hookswith_options
method to effectively pass arbitrary **kwargs
to your hooks: