-
Notifications
You must be signed in to change notification settings - Fork 311
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
Better error message when starting kernel for session. #1478
Conversation
Closes #1186 then? |
@@ -161,6 +161,8 @@ async def patch(self, session_id): | |||
changes["kernel_id"] = kernel_id | |||
elif model["kernel"].get("name") is not None: | |||
kernel_name = model["kernel"]["name"] | |||
|
|||
try: | |||
kernel_id = await sm.start_kernel_for_session( | |||
session_id, | |||
kernel_name=kernel_name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of the test failures are relavant:
File "D:\a\jupyter_server\jupyter_server\jupyter_server\services\sessions\handlers.py", line 168, in patch
kernel_name=kernel_name,
UnboundLocalError: local variable 'kernel_name' referenced before assignment
I think the try:
needs one more indentation level
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry, yes. I'm tired today.
This catches error when starting a kernel for a session (for example if one switches the kernel for an existing notebook), and propagate the error. Otherwise the frontend will just show "Error: uncaught exception". In addition this setup ruff G001 – do not use string formatting in logging, see some of the reasons to not do that: https://docs.astral.sh/ruff/rules/logging-string-format/ And fixes the few instances where jupyter-server does it.
Co-authored-by: Michał Krassowski <5832902+krassowski@users.noreply.github.com>
63e7c42
to
5266697
Compare
Co-authored-by: David Brochart <david.brochart@gmail.com>
I published a new version of jupyter-events, retriggering CI. |
only part of it. that would be solved by enabling G002 |
Working on #1481 to fix the unrelated errors. |
Awesome ! Thanks ! |
This catches error when starting a kernel for a session (for example if one switches the kernel for an existing notebook), and propagate the error. Otherwise the frontend will just show "Error: uncaught exception".
In addition this setup ruff G001 – do not use string formatting in logging, see some of the reasons to not do that:
https://docs.astral.sh/ruff/rules/logging-string-format/
And fixes the few instances where jupyter-server does it.