takluyver / nbopen

Open a Jupyter notebook in the best available server
BSD 3-Clause "New" or "Revised" License
304 stars 58 forks source link

Kernel/server shutdown #19

Open tritemio opened 9 years ago

tritemio commented 9 years ago

Is there any mechanism in nbopen for server shut-down when opening notebooks via double-click?

The ideal would be detecting when the tab is closed and shutting down the server.

If this is impossible, then a panel applet listing the kernels with the ability to close them would be an alternative.

takluyver commented 9 years ago

We don't have a reliable way of detecting when tabs are closed. I have another project nbmanager which lists running notebooks and lets you shut them down.

vidartf commented 7 years ago

I guess you would need a double extensions: A python extension to allow remote shutdown of the server, and a javascript extension to a) Add a button to halt the kernel/server, and/or: b) add an event listener for window.onbeforeunload, and have it halt kernel/server. This will however mean that refreshing the notebook page will shut down the server.

takluyver commented 7 years ago

onbeforeunload is tricky for a variety of reasons - you may have opened other tabs to the same server, and I'm not sure it can reliably send a request before the associated tab closes.

I vaguely remember that way back in the early days of the notebook we did have a handler and a button to shut the server down. I can't remember now why we got rid of it.