on_exit
functiongworker_client.lifecycle.on_exit
Lifecycle hook that runs once on container shutdown. Use to flush buffers, close connections, or release GPU memory. Not guaranteed to run on hard kill (OOM, SIGKILL).
Signature
python
1on_exit() -> Callable[[_F], _F]