diff --git a/tests/app/conftest.py b/tests/app/conftest.py index 08d1e4e5c..55f81a7ea 100644 --- a/tests/app/conftest.py +++ b/tests/app/conftest.py @@ -19,7 +19,7 @@ def voila_config(): @pytest.fixture def voila_args_extra(): - return [] + return ['--VoilaExecutor.timeout=240'] @pytest.fixture diff --git a/tests/app/execute_cpp_test.py b/tests/app/execute_cpp_test.py index abc9afc57..b3ddae10f 100644 --- a/tests/app/execute_cpp_test.py +++ b/tests/app/execute_cpp_test.py @@ -11,7 +11,7 @@ def cpp_file_url(base_url): @pytest.fixture def voila_args_extra(): - return ['--VoilaConfiguration.extension_language_mapping={".xcpp": "C++11"}'] + return ['--VoilaConfiguration.extension_language_mapping={".xcpp": "C++11"}', '--VoilaExecutor.timeout=240'] @pytest.fixture diff --git a/tests/app/many_iopub_messages_test.py b/tests/app/many_iopub_messages_test.py index 0cbf57653..bf3441d5a 100644 --- a/tests/app/many_iopub_messages_test.py +++ b/tests/app/many_iopub_messages_test.py @@ -5,7 +5,7 @@ @pytest.fixture def voila_args_extra(): - return ['--ExecutePreprocessor.timeout=180'] + return ['--VoilaExecutor.timeout=180'] @pytest.fixture diff --git a/tests/app/no_strip_sources_test.py b/tests/app/no_strip_sources_test.py index b29394ec2..fd3cea121 100644 --- a/tests/app/no_strip_sources_test.py +++ b/tests/app/no_strip_sources_test.py @@ -8,7 +8,7 @@ @pytest.fixture def voila_args_extra(): - return ['--VoilaConfiguration.strip_sources=False'] + return ['--VoilaConfiguration.strip_sources=False', '--VoilaExecutor.timeout=240'] async def test_no_strip_sources(http_server_client, base_url): diff --git a/tests/app/template_arg_test.py b/tests/app/template_arg_test.py index 0f6a82221..76f40bda5 100644 --- a/tests/app/template_arg_test.py +++ b/tests/app/template_arg_test.py @@ -4,7 +4,7 @@ @pytest.fixture def voila_args_extra(): - return ['--template=test_template'] + return ['--template=test_template', '--VoilaExecutor.timeout=240'] async def test_template(http_server_client, base_url): diff --git a/tests/app/template_cli_test.py b/tests/app/template_cli_test.py index 8b12d3870..165c1b5c7 100644 --- a/tests/app/template_cli_test.py +++ b/tests/app/template_cli_test.py @@ -10,7 +10,7 @@ def voila_args_extra(): path_test_template = os.path.abspath(os.path.join(BASE_DIR, '../test_template/share/jupyter/voila/templates/test_template/')) path_default = os.path.abspath(os.path.join(BASE_DIR, '../../share/jupyter/voila/templates/default')) - return ['--template=None', '--VoilaTest.template_paths=[%r, %r]' % (path_test_template, path_default)] + return ['--template=None', '--VoilaTest.template_paths=[%r, %r]' % (path_test_template, path_default), '--VoilaExecutor.timeout=240'] async def test_template_test(http_server_client, base_url): diff --git a/tests/app/template_config_file_test.py b/tests/app/template_config_file_test.py index 646965c38..a88f54da3 100644 --- a/tests/app/template_config_file_test.py +++ b/tests/app/template_config_file_test.py @@ -10,7 +10,7 @@ def voila_args_extra(): path_test_template = os.path.abspath(os.path.join(BASE_DIR, '../test_template/share/jupyter/voila/templates/test_template/nbconvert_templates')) path_default = os.path.abspath(os.path.join(BASE_DIR, '../../share/jupyter/voila/templates/default/nbconvert_templates')) - return ['--template=test_template', '--Voila.nbconvert_template_paths=[%r, %r]' % (path_test_template, path_default)] + return ['--template=test_template', '--Voila.nbconvert_template_paths=[%r, %r]' % (path_test_template, path_default), '--VoilaExecutor.timeout=240'] async def test_template_test(http_server_client, base_url): diff --git a/tests/app/template_custom_test.py b/tests/app/template_custom_test.py index cae233cba..20968a61d 100644 --- a/tests/app/template_custom_test.py +++ b/tests/app/template_custom_test.py @@ -8,7 +8,7 @@ @pytest.fixture def voila_args_extra(): - return ['--template=None'] + return ['--template=None', '--VoilaExecutor.timeout=240'] @pytest.fixture diff --git a/tests/app/tree_test.py b/tests/app/tree_test.py index e5cf46513..ac0f34d2f 100644 --- a/tests/app/tree_test.py +++ b/tests/app/tree_test.py @@ -9,7 +9,7 @@ def voila_args(notebook_directory, voila_args_extra): @pytest.fixture def voila_args_extra(): - return ['--VoilaConfiguration.extension_language_mapping={".xcpp": "C++11"}'] + return ['--VoilaConfiguration.extension_language_mapping={".xcpp": "C++11"}', '--VoilaExecutor.timeout=240'] async def test_tree(http_server_client, base_url): diff --git a/voila/_version.py b/voila/_version.py index 6ebc829cb..b2ca0eea1 100644 --- a/voila/_version.py +++ b/voila/_version.py @@ -7,7 +7,7 @@ # The full license is in the file LICENSE, distributed with this software. # ############################################################################# -version_info = (0, 2, 0, 'alpha', 0) +version_info = (0, 2, 0, 'alpha', 1) _specifier_ = {'alpha': 'a', 'beta': 'b', 'candidate': 'rc', 'final': ''} diff --git a/voila/handler.py b/voila/handler.py index adb6ca6de..23559b4fe 100644 --- a/voila/handler.py +++ b/voila/handler.py @@ -117,25 +117,8 @@ def redirect_to_file(self, path): async def _jinja_kernel_start(self): assert not self.kernel_started, "kernel was already started" - kernel_id = await self.kernel_manager.start_kernel(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 = VoilaExecutor(self.notebook, km=km, config=self.traitlet_config) - self.executor.kc = km.client() - self.executor.kc.start_channels() - try: - await self.executor.kc.wait_for_ready(timeout=self.executor.startup_timeout) - except RuntimeError: - self.executor.kc.stop_channels() - self.executor.km.shutdown_kernel() - raise - self.executor.kc.allow_stdin = False + 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) self.kernel_started = True return kernel_id