Delete session but atexit or SIGTERM is not triggered

Hello, I met a problem that, when I end a session with the DELETE session API, I can not use atexit or SIGTERM to run additional code when the session end.
In this matter, I use the REST-API to contact to a jupyter server: First I use POST to create a new session, then I use websocket to send the code to the server, and at last I DELETE the session but neither atexit or SIGTERM is triggered.
Is there any API to end a session the same with the “shutdown” in the UI do?where atexit or SIGTERM can be triggered properly. Thanks very much for the help!

Solved. It end up that the atexit and “finally” are triggered properly when DELETE session is sent.

1 Like