gophernotes icon indicating copy to clipboard operation
gophernotes copied to clipboard

stop notebook on error

Open elamre opened this issue 2 years ago • 2 comments

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?

elamre avatar Jul 21 '22 05:07 elamre

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 ?

cosmos72 avatar Aug 05 '22 16:08 cosmos72

seems possible at the protocol level:

  • https://jupyter-client.readthedocs.io/en/latest/messaging.html#messages-on-the-control-router-dealer-channel
  • https://jupyter-client.readthedocs.io/en/latest/messaging.html#kernel-interrupt

sbinet avatar Aug 17 '22 15:08 sbinet