Skip to content

Commit

Permalink
Use future nbclient which ensures the client is async
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbrochart authored and SylvainCorlay committed Jun 1, 2020
1 parent 5aa8d8f commit dead1ec
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions voila/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,6 @@ async def _jinja_kernel_start(self):
assert not self.kernel_started, "kernel was already started"
self.executor = VoilaExecutor(self.notebook, km=self.kernel_manager, config=self.traitlet_config)
kc, kernel_id = await self.executor.async_start_new_kernel_client(kernel_name=self.notebook.metadata.kernelspec.name, path=self.cwd)
km = self.kernel_manager.get_kernel(kernel_id)
# When Voila is launched as an app, its kernel manager's type is AsyncMappingKernelManager, and thus
# its kernel client's type is AsyncKernelClient.
# But this has to be explicitly configured when launched as a server extension, with e.g.:
# --ServerApp.kernel_manager_class=jupyter_server.services.kernels.kernelmanager.AsyncMappingKernelManager
# If it's not done, the kernel manager might not be async, which is not a big deal, but we want the kernel
# client to be async, so we explicitly configure it for this particular case:
km.client_class = 'jupyter_client.asynchronous.AsyncKernelClient'
self.executor.kc = km.client()
self.kernel_started = True
return kernel_id

Expand Down

0 comments on commit dead1ec

Please sign in to comment.