scott
04/21/2023, 10:07 PMon_completion
and on_failure
hooks ignored when a task state is Cached
? That seems to be the case, but AFAIK there’s no docs (https://github.com/PrefectHQ/prefect/issues/8967)Ryan Peden
04/21/2023, 11:25 PMengine.py
, the on_completion
and on_failure
hooks for tasks get called during the task run here.
But if there's a cached result for a task, the Prefect API rejects the proposal to transition the task from PENDING -> RUNNING and instead returns the terminal state with the cached result attached.
When that happens, the state.is_running()
check here is false, and block of code with the hook call gets skipped.scott
04/21/2023, 11:28 PMon_exit
that would run no matter what the end state - but I’ve hacked something together to get around this (to trigger whether a task state is failed/completed/cached)Ryan Peden
04/21/2023, 11:38 PMscott
04/21/2023, 11:38 PM