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

Better error message when starting kernel for session. #1478

Merged
merged 3 commits into from
Dec 19, 2024

Conversation

Carreau
Copy link
Contributor

@Carreau Carreau commented Dec 17, 2024

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.

@krassowski
Copy link
Collaborator

In addition this setup ruff G001 – do not use string formatting in logging, see some of the reasons to not do that:

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,
Copy link
Collaborator

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

Copy link
Contributor Author

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.

jupyter_server/gateway/managers.py Outdated Show resolved Hide resolved
Carreau and others added 2 commits December 17, 2024 11:40
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>
@Carreau Carreau force-pushed the catch-session-change branch from 63e7c42 to 5266697 Compare December 17, 2024 10:40
Co-authored-by: David Brochart <david.brochart@gmail.com>
@Carreau
Copy link
Contributor Author

Carreau commented Dec 17, 2024

I published a new version of jupyter-events, retriggering CI.

@Carreau
Copy link
Contributor Author

Carreau commented Dec 17, 2024

In addition this setup ruff G001 – do not use string formatting in logging, see some of the reasons to not do that:

Closes #1186 then?

only part of it. that would be solved by enabling G002

@Carreau
Copy link
Contributor Author

Carreau commented Dec 17, 2024

Working on #1481 to fix the unrelated errors.

@minrk minrk closed this Dec 19, 2024
@minrk minrk reopened this Dec 19, 2024
@minrk minrk merged commit dff1599 into jupyter-server:main Dec 19, 2024
71 of 103 checks passed
@Carreau
Copy link
Contributor Author

Carreau commented Dec 19, 2024

Awesome ! Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants