From 096e25f235f707897731d093c9dfa3db0b6dc34c Mon Sep 17 00:00:00 2001 From: martinRenou Date: Mon, 26 Jun 2023 13:41:48 +0200 Subject: [PATCH] Only clean the kernel client --- voila/notebook_renderer.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/voila/notebook_renderer.py b/voila/notebook_renderer.py index e949fc3be..b1a47280e 100644 --- a/voila/notebook_renderer.py +++ b/voila/notebook_renderer.py @@ -244,6 +244,8 @@ async def _jinja_notebook_execute(self, nb, kernel_id): # (it seems to be local to our block) nb.cells = result.cells + await self._cleanup_resources() + async def _jinja_cell_generator(self, nb, kernel_id): """Generator that will execute a single notebook cell at a time""" nb, _ = ClearOutputPreprocessor().preprocess( @@ -293,6 +295,11 @@ async def _jinja_cell_generator(self, nb, kernel_id): finally: yield output_cell + await self._cleanup_resources() + + async def _cleanup_resources(self): + await ensure_async(self.executor.kc.stop_channels()) + async def load_notebook(self, path): model = await ensure_async(self.contents_manager.get(path=path)) if "content" not in model: