You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The on_crashed hook does not execute, even though Prefect is clearly transitioning to a Crashed state. For instance, when a flow is sent a SIGINT via ^C, Prefect correctly traps the interrupt signal and transitions to a Crashed state but then does not execute the hook:
importprefectfromtimeimportsleepdefcrash_hook(*args):
print("crashed!!!")
@prefect.flow(name="test", on_crashed= [crash_hook])defflow():
sleep(10)
>>>flow()
21:07:07.610|INFO|prefect.engine-Createdflowrun'spiritual-llama'forflow'test'21:07:07.612|INFO|prefect.engine-Viewathttp://127.0.0.1:4200/runs/flow-run/2d5a7b50-5eb5-4f80-a98b-867b84908c4c^C21:07:11.196|ERROR|Flowrun'spiritual-llama'-Crashdetected! Executionwasabortedbyaninterruptsignal.
21:07:11.235|ERROR|Flowrun'spiritual-llama'-FinishedinstateCrashed('Execution was aborted by an interrupt signal.')
---------------------------------------------------------------------------KeyboardInterruptTraceback (mostrecentcalllast)
...
<standardstacktrace>
...
As you can see, crash_hook does not execute at all.
Note that the hook also fails to execute for other sorts of crash (not just SIGINT), e.g.
@prefect.flow(name="test", on_crashed= [crash_hook])defflow():
raiseSystemExit("crash!")
>>>flow()
21:18:39.626|INFO|prefect.engine-Createdflowrun'amigurumi-chinchilla'forflow'test'21:18:39.627|INFO|prefect.engine-Viewathttp://127.0.0.1:4200/runs/flow-run/73be1fc7-344b-4293-abe2-86c20c62e81521:18:39.671|ERROR|Flowrun'amigurumi-chinchilla'-Crashdetected! ExecutionwasabortedbyPythonsystemexitcall.
21:18:39.697|ERROR|Flowrun'amigurumi-chinchilla'-FinishedinstateCrashed('Execution was aborted by Python system exit call.')
Anexceptionhasoccurred, use%tbtoseethefulltraceback.
SystemExit: crash!
Again, the crash is properly intercepted, but the hook does not fire.
Version info
Version: 3.1.5
API version: 0.8.4
Python version: 3.12.7
Git commit: 3c06654e
Built: Mon, Dec 2, 2024 6:57 PM
OS/Arch: linux/x86_64
Profile: local
Server type: server
Pydantic version: 2.10.3
Additional context
No response
The text was updated successfully, but these errors were encountered:
Bug summary
The
on_crashed
hook does not execute, even though Prefect is clearly transitioning to aCrashed
state. For instance, when a flow is sent a SIGINT via ^C, Prefect correctly traps the interrupt signal and transitions to aCrashed
state but then does not execute the hook:As you can see,
crash_hook
does not execute at all.Note that the hook also fails to execute for other sorts of crash (not just SIGINT), e.g.
Again, the crash is properly intercepted, but the hook does not fire.
Version info
Additional context
No response
The text was updated successfully, but these errors were encountered: