Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kernel shutdown when closing notebook tab #6275

Merged
merged 4 commits into from Apr 29, 2019

Conversation

@fcollonval
Copy link
Member

@fcollonval fcollonval commented Apr 29, 2019

References

Issue: #5241
This is a simplified approach of PR #5914 as suggested by @ellisonbg to target v1.0.

Code changes

To shutdown a kernel when closing a tab, a call session.shutdown is performed when ClientSession is disposed. This is not done in NotebookPanel.dispose to prevent a kernel shutdown when multi-views on a notebook are opened.

To pass the parameter from the settings to the ClientSession, a new attribute has been added in kernelPreference provided by the widget factory.

User-facing changes

New settings:
Notebook -> Shutdown kernel

Note

If activated, closing the notebook panel with an associated console view will result in the kernel shutdown. Therefore the opened console will lost its kernel connection.

@jupyterlab-dev-mode
Copy link

@jupyterlab-dev-mode jupyterlab-dev-mode bot commented Apr 29, 2019

Thanks for making a pull request to JupyterLab!

To try out this branch on binder, follow this link: Binder

@jasongrout
Copy link
Contributor

@jasongrout jasongrout commented Apr 29, 2019

If activated, closing the notebook panel with an associated console view will result in the kernel shutdown. Therefore the opened console will lost its kernel connection.

Does this also mean that if I open a console associated with a notebook, then close the console, the notebook's kernel will shut down?

@fcollonval
Copy link
Member Author

@fcollonval fcollonval commented Apr 29, 2019

Does this also mean that if I open a console associated with a notebook, then close the console, the notebook's kernel will shut down?

Nothing has been implemented in this PR regarding the console. In your scenario, the notebook kernel will continue to run.

I try to implement a similar setting for the console. But I hit your point as I did not figure out how could I distinguish console created from scratch, from file or from notebook. I thought I could test whether the path is provided or not at console creation. But this will result in a kernel still running when closing console linked to a python script for example. I don't think that this will be expected by the user.

I propose to limit this PR to notebook tab.

@fcollonval fcollonval changed the title [WIP] Kernel shutdown when closing tab [WIP] Kernel shutdown when closing notebook tab Apr 29, 2019
@jasongrout
Copy link
Contributor

@jasongrout jasongrout commented Apr 29, 2019

I propose to limit this PR to notebook tab.

That sounds reasonable.

@fcollonval fcollonval changed the title [WIP] Kernel shutdown when closing notebook tab Kernel shutdown when closing notebook tab Apr 29, 2019
@fcollonval
Copy link
Member Author

@fcollonval fcollonval commented Apr 29, 2019

Thanks for the review @jasongrout

This is good to go for me.

Copy link
Member

@blink1073 blink1073 left a comment

Looks great, thanks!

@blink1073 blink1073 merged commit 25d8709 into jupyterlab:master Apr 29, 2019
9 checks passed
@fcollonval fcollonval deleted the kernel-shutdown branch Apr 30, 2019
@jasongrout jasongrout added this to the 1.0 milestone May 29, 2019
@lock
Copy link

@lock lock bot commented Aug 6, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related discussion.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants