gopherdata / gophernotes

The Go kernel for Jupyter notebooks and nteract.
MIT License
3.8k stars 262 forks source link

stop notebook on error #251

Open elamre opened 1 year ago

elamre commented 1 year ago

Is there a way for the notebook to stop running on error? It ignores my Panic statements (other than just printing out) and even os.Exit doesn't seem to do much. Am I missing somethign?

cosmos72 commented 1 year ago

You want to stop a notebook server programmatically?

Executing os.Exit will cause gophernotes to exit, but jupyter (or whatever notebook frontend you are using) will just notice it, show a message similar to

Kernel Restarting
The kernel appears to have died. It will restart automatically.

and start another gophernotes process.

So the solution, if any, is to send a ZMQ message from gophernotes to the notebook asking it to exit. Spoiler: I have no idea if notebook's protocol define such a message. Maybe @sbinet ?

sbinet commented 1 year ago

seems possible at the protocol level: