Martin Janiczek
05/27/2026, 12:15 PMMarvin
05/27/2026, 12:15 PMMarvin
05/27/2026, 12:18 PMon_late argument on @flow. The supported flow hooks are:
- on_completion
- on_failure
- on_cancellation
- on_crashed
- on_running
So if you're looking for something parallel to:
python
@flow(on_cancellation=[...])
there isn't an equivalent:
python
@flow(on_late=[...]) # not supported
Why: Late is emitted as a flow-run state/event, but Prefect does not expose it as a flow hook. Verified in the docs/source for state change hooks and flow-run events:
- State change hooks
- Flow run events
Recommended approach: use an Automation that listens for the prefect.flow-run.Late event.
That’s the robust/server-side way to react to late runs:
- Create automations
- Event triggers
- Automations
Conceptually, you want:
- trigger on prefect.flow-run.Late
- then run an action like a notification, webhook, or triggered deployment
A minimal example pattern is:
json
{
"trigger": {
"type": "event",
"posture": "Reactive",
"expect": ["prefect.flow-run.Late"]
}
}
One important note from Prefect docs: hooks are client-side / best-effort, while automations are the preferred mechanism for reliable reactions to flow-run state changes.
If you want, I can give you either:
1. a Prefect Cloud automation example for Late runs, or
2. a Python/CLI example to create one.