Skip to content

Commit

Permalink
Merge pull request #740 from jtpio/await-kernel-ready
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 authored Jan 21, 2022
2 parents 2631730 + bf08cde commit 2c9fbf4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions jupyter_client/multikernelmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,12 @@ async def _async_shutdown_kernel(
if self._using_pending_kernels() and kernel_id in self._pending_kernels:
raise RuntimeError("Kernel is in a pending state. Cannot shutdown.")
# If the kernel is still starting, wait for it to be ready.
elif kernel_id in self._starting_kernels:
kernel = self._starting_kernels[kernel_id]
elif kernel_id in self._pending_kernels:
kernel = self._pending_kernels[kernel_id]
try:
await kernel
km = self.get_kernel(kernel_id)
await km.ready
except Exception:
self.remove_kernel(kernel_id)
return
Expand Down

0 comments on commit 2c9fbf4

Please sign in to comment.