From 22242730e8b2aaf8a5113e70ba7358226bd53fe2 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Tue, 20 Sep 2022 21:34:53 -0500 Subject: [PATCH 1/3] Test with client 8 updates --- .github/workflows/python-tests.yml | 1 + jupyter_server/services/kernels/handlers.py | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index 08c20a2913..4fdffb2816 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -125,6 +125,7 @@ jobs: pip check - name: Run the tests run: | + pip install jupyter_client@https://github.com/blink1073/jupyter_client/archive/refs/heads/synchronous_managers.zip pytest -vv || pytest -vv --lf make_sdist: diff --git a/jupyter_server/services/kernels/handlers.py b/jupyter_server/services/kernels/handlers.py index 8b3ff7dc62..30e3da329f 100644 --- a/jupyter_server/services/kernels/handlers.py +++ b/jupyter_server/services/kernels/handlers.py @@ -4,6 +4,7 @@ """ # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. +import asyncio import json from textwrap import dedent from traceback import format_tb @@ -15,8 +16,9 @@ except ImportError: from jupyter_client.jsonutil import date_default as json_default +from concurrent.futures import Future + from tornado import gen, web -from tornado.concurrent import Future from tornado.ioloop import IOLoop from jupyter_server.auth import authorized @@ -55,7 +57,9 @@ async def post(self): else: model.setdefault("name", km.default_kernel_name) - kernel_id = await km.start_kernel(kernel_name=model["name"], path=model.get("path")) + kernel_id = await ensure_async( + km.start_kernel(kernel_name=model["name"], path=model.get("path")) + ) model = await ensure_async(km.kernel_model(kernel_id)) location = url_path_join(self.base_url, "api", "kernels", url_escape(kernel_id)) self.set_header("Location", location) @@ -404,7 +408,7 @@ def give_up(): loop = IOLoop.current() loop.add_timeout(loop.time() + self.kernel_info_timeout, give_up) # actually wait for it - await future + await asyncio.wrap_future(future) async def get(self, kernel_id): self.kernel_id = kernel_id From 5cc8cdcefd4d1bce842cbc0e0fddf44359dcdb6f Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Tue, 20 Sep 2022 21:40:23 -0500 Subject: [PATCH 2/3] try integration tests with client 8 --- .github/workflows/integration-tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 987ea15c83..8335318dc1 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -27,6 +27,7 @@ jobs: pip check - name: Run the tests run: | + pip install jupyter_client@https://github.com/blink1073/jupyter_client/archive/refs/heads/synchronous_managers.zip pytest -vv --integration_tests=true tests integration_check: # This job does nothing and is only used for the branch protection From 24a3133fd261372d65f2eb6c4a31c2efa4f8adba Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Tue, 20 Sep 2022 21:41:03 -0500 Subject: [PATCH 3/3] do it with both --- .github/workflows/integration-tests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 8335318dc1..b3dad9e389 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -25,6 +25,9 @@ jobs: run: | pip freeze pip check + - name: Run the tests + run: | + pytest -vv --integration_tests=true tests - name: Run the tests run: | pip install jupyter_client@https://github.com/blink1073/jupyter_client/archive/refs/heads/synchronous_managers.zip