https://prefect.io logo
i

imcom

07/30/2023, 9:20 AM
hi folks , I am wondering how to use
on_cancellation
state change hook? From what I've seen so far, if I try to catch
except (asyncio.exceptions.CancelledError, prefect.exceptions.TerminationSignal)
and then return
return Cancelled(_message_=f"Cancelled: {_task_id_} is cancelled")
in the
flow
logic, I ended up with no
cancellation
hook fired at all. I've also tried returning
Cancelling
state, still no go. Could anyone shed some lights on the cancellation hook?