justabill05/04/2023, 8:12 PM
hook for flows, allowing you to add client-side hooks that will be called when your flow crashes. This is useful for cases where you want to execute code without involving the Prefect API, and for custom handling on
terminal states. This callable hook will receive three arguments:
Check out the release notes for more information.
from prefect import flow def crash_hook(flow, flow_run, state): print("Don't Panic! But the flow has crashed...") @flow(on_crashed=[crash_hook]) def my_flow(): # call `crash_hook` if this flow enters a `CRASHED` state pass