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

Add button closing dangling kernels #13916

Open
fcollonval opened this issue Feb 3, 2023 · 6 comments · May be fixed by #16341
Open

Add button closing dangling kernels #13916

fcollonval opened this issue Feb 3, 2023 · 6 comments · May be fixed by #16341

Comments

@fcollonval
Copy link
Member

fcollonval commented Feb 3, 2023

The "dangling" kernel is actually a real live kernel session that still exists but had no visibility before.

It was visible before too (and is on 3.x and 2.x). This is the where users refer to when they run low on memory (killing old kernels from closed notebooks that were previously closed). Maybe we even should have a button for "Kill all kernels which do not have any notebook/console".

On this use-case we could have something like this:

Screenshot from 2023-01-24 19-53-59

Note: the numbers in circles on the graphic are irrelevant; those were from an exploration suggesting how to show the number of documents/widgets connected to the kernel.

Originally posted by @krassowski in #13779 (comment)

@jupyterlab-probot jupyterlab-probot bot added the status:Needs Triage Applied to new issues that need triage label Feb 3, 2023
@krassowski krassowski changed the title Add closing dangling kernels button Add button closing dangling kernels Feb 3, 2023
@krassowski krassowski removed the status:Needs Triage Applied to new issues that need triage label Feb 3, 2023
@afshin
Copy link
Member

afshin commented Feb 3, 2023

Will the definition of "dangling" include kernels that come from external sources and may have active users in another application?

@krassowski
Copy link
Member

Good question. I think it should not.

And we probably should find a better word than "dangling" but "disconnected" would be too overloaded to be useful; "unused" feels like the right direction.

@cherieliu
Copy link

Hi @krassowski, this is my first time contributing to open source, and I want to work on this issue. Do you have any guidance?

@HarryDoan1
Copy link

Hello @krassowski, is this a frontend issue? This is my first time, and I would love to contribute. Can you let me know what I need to do?

@krassowski
Copy link
Member

Sure you are welcome to open a draft pull request as soon as you got something working!

We have a contributing guide which should answer some basic questions about setup, but if you cannot find the answer in there you can reach out on JupyterLab gitter.

Changes would likely be contained to:

class Section extends PanelWithToolbar {
constructor(options: {
manager: IRunningSessions.IManager;
translator?: ITranslator;
}) {
super();
this._manager = options.manager;
const translator = options.translator || nullTranslator;
const trans = translator.load('jupyterlab');
const shutdownAllLabel =
options.manager.shutdownAllLabel || trans.__('Shut Down All');
const shutdownTitle = `${shutdownAllLabel}?`;
const shutdownAllConfirmationText =
options.manager.shutdownAllConfirmationText ||
`${shutdownAllLabel} ${options.manager.name}`;
this.addClass(SECTION_CLASS);
this.title.label = options.manager.name;
function onShutdown() {
void showDialog({
title: shutdownTitle,
body: shutdownAllConfirmationText,
buttons: [
Dialog.cancelButton(),
Dialog.warnButton({ label: shutdownAllLabel })
]
}).then(result => {
if (result.button.accept) {
options.manager.shutdownAll();
}
});
}
let runningItems = options.manager.running();
const enabled = runningItems.length > 0;
this._button = new ToolbarButton({
label: shutdownAllLabel,
className: `${SHUTDOWN_ALL_BUTTON_CLASS} jp-mod-styled ${
!enabled && 'jp-mod-disabled'
}`,
enabled,
onClick: onShutdown
});
this._manager.runningChanged.connect(this._updateButton, this);
this.toolbar.addItem('shutdown-all', this._button);
this.addWidget(
new ListWidget({ runningItems, shutdownAllLabel, ...options })
);
}

as a final step, ideally we would also update the documentation:

.. _shutdown-all-kernels:
You can shut down all kernels and terminals by clicking the ``X``
button:

@krassowski
Copy link
Member

krassowski commented Oct 6, 2023

Maybe the user-facing label should be "Closed Unused" "Shut Down Unused" rather than "Close dangling".

@NexVeridian NexVeridian linked a pull request May 17, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants