Skip to content

Commit

Permalink
Don't reset the MultiKernelManager's default kernel name if the Kerne…
Browse files Browse the repository at this point in the history
…lSpecManager's default kernel name is set to be empty
  • Loading branch information
ojarjur committed May 5, 2023
1 parent 408cc88 commit 11f8c71
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion jupyter_server/services/kernels/kernelmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,10 @@ def _default_default_kernel_name(self):

@observe("default_kernel_name")
def _observe_default_kernel_name(self, change):
if hasattr(self.kernel_spec_manager, "default_kernel_name"):
if (
hasattr(self.kernel_spec_manager, "default_kernel_name")
and self.kernel_spec_manager.default_kernel_name
):
# If the kernel spec manager defines a default kernel name, treat that
# one as authoritative.
kernel_name = change.new
Expand All @@ -740,6 +743,8 @@ def _observe_default_kernel_name(self, change):
def _on_kernel_spec_manager_default_kernel_name_changed(self, change):
# Sync the kernel-spec-manager's trait to the multi-kernel-manager's trait.
kernel_name = change.new
if kernel_name is None:
return
self.log.debug(f"KernelSpecManager default kernel name changed: {kernel_name}")
self.default_kernel_name = kernel_name

Expand Down

0 comments on commit 11f8c71

Please sign in to comment.