Skip to content

Commit

Permalink
Fix notebook_execute (#2)
Browse files Browse the repository at this point in the history
* Fix notebook_execute

* Add kernel_id back
  • Loading branch information
davidbrochart authored and SylvainCorlay committed May 27, 2020
1 parent f9a0be1 commit af608ae
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions voila/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

from nbconvert.preprocessors import ClearOutputPreprocessor

from .execute import executenb, VoilaExecutor
from .execute import VoilaExecutor
from .exporter import VoilaExporter


Expand Down Expand Up @@ -139,9 +139,8 @@ async def _jinja_kernel_start(self):
self.kernel_started = True
return kernel_id

def _jinja_notebook_execute(self, nb, kernel_id):
km = self.kernel_manager.get_kernel(kernel_id)
result = executenb(nb, km=km, cwd=self.cwd, config=self.traitlet_config, nest_asyncio=True)
async def _jinja_notebook_execute(self, nb, kernel_id):
result = await self.executor.async_execute()
# we modify the notebook in place, since the nb variable cannot be reassigned it seems in jinja2
# e.g. if we do {% with nb = notebook_execute(nb, kernel_id) %}, the base template/blocks will not
# see the updated variable (it seems to be local to our block)
Expand Down

0 comments on commit af608ae

Please sign in to comment.