Marvin
03/01/2024, 4:11 PMpython
from prefect import flow
def my_success_hook(flow, flow_run, state):
print(f"Flow run {flow_run.id} finished with state {state}")
You would then attach this hook to a flow state handler when defining your flow.
For more details on state change hooks and examples, you can refer to the Prefect documentation:
- State Change Hooks
- Final state determination
Remember, the above code snippet is a starting point. You'll need to flesh it out with your specific logic for handling various state changes.