Skip to content

Commit

Permalink
Merge pull request #511 from higgsb0/use_kernel_id
Browse files Browse the repository at this point in the history
Use kernel_id for new kernel if it doesn't exist in MappingKernelManager.start_kernel
  • Loading branch information
Zsailer authored May 7, 2021
2 parents 3927d28 + 20f93cc commit 627898f
Showing 1 changed file with 3 additions and 2 deletions.
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

0 comments on commit 627898f

Please sign in to comment.