brief-family-9488
08/07/2025, 6:28 PMjolly-florist-66728
08/07/2025, 6:28 PMjolly-florist-66728
08/07/2025, 6:29 PMon_failure
handler in your workflow, but this does not allow you to arbitrarily set the workflow status; it only reacts to actual failures in execution. For more, see the failure node documentation and workflow basics.
Would you like more detail or example code for handling this pattern?
Sources:
- failure node documentation
- workflow basics 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.brief-family-9488
08/07/2025, 6:31 PMbrief-family-9488
08/07/2025, 6:31 PMjolly-florist-66728
08/07/2025, 6:31 PMjolly-florist-66728
08/07/2025, 6:32 PMon_failure
handler in your workflow. The failure node will execute if any task in the workflow fails. The cleanup task's inputs must match the workflow's inputs, and it can also accept an err
parameter for the error message. This feature is available in Flyte 1.10.7 and later. See the official example:
from flytekit import task, workflow
@task
def clean_up(name: str, err: str = None):
print(f"Cleaning up {name} due to error: {err}")
@task
def will_fail(name: str):
raise Exception("Intentional failure")
@workflow(on_failure=clean_up)
def my_wf(name: str):
will_fail(name=name)
If will_fail
fails, clean_up
will be executed automatically.
Would you like a more detailed breakdown or explanation?
Sources:
- failure node documentation 👍 0 button 👎 0 button 💡 Hint: Mention @runllm in the thread for followups.