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

Use kernel_id for new kernel if it doesn't exist in MappingKernelManager.start_kernel #511

Merged
merged 5 commits into from
May 7, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions jupyter_server/services/kernels/kernelmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,11 @@ async def start_kernel(self, kernel_id=None, path=None, **kwargs):
The name identifying which kernel spec to launch. This is ignored if
an existing kernel is returned, but it may be checked in the future.
"""
if kernel_id is None:
if kernel_id is None or kernel_id not in self:
if path is not None:
kwargs['cwd'] = self.cwd_for_path(path)
if kernel_id is not None:
kwargs['kernel_id'] = kernel_id
kernel_id = await ensure_async(self.pinned_superclass.start_kernel(self, **kwargs))
self._kernel_connections[kernel_id] = 0
self._kernel_ports[kernel_id] = self._kernels[kernel_id].ports
Expand All @@ -201,7 +203,6 @@ async def start_kernel(self, kernel_id=None, path=None, **kwargs):
).inc()

else:
self._check_kernel_id(kernel_id)
self.log.info("Using existing kernel: %s" % kernel_id)

# Initialize culling if not already
Expand Down