From e418c8c196b6ca2bd501248efe406fc966bef1503877edeca9c3e2144378c97f Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Tue, 25 Jan 2022 09:33:17 +0000 Subject: [PATCH] - add distributed-fix-python310.patch to fix build with python 3.10 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-distributed?expand=0&rev=102 --- distributed-fix-python310.patch | 60 +++++++++++++++++++++++++++++++++ python-distributed.changes | 5 +++ python-distributed.spec | 3 +- 3 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 distributed-fix-python310.patch diff --git a/distributed-fix-python310.patch b/distributed-fix-python310.patch new file mode 100644 index 0000000..deac6f5 --- /dev/null +++ b/distributed-fix-python310.patch @@ -0,0 +1,60 @@ +From f78696ebe8d1629fd946a4606be306bd0dbadb15 Mon Sep 17 00:00:00 2001 +From: Elliott Sales de Andrade +Date: Sun, 26 Sep 2021 19:30:38 -0400 +Subject: [PATCH] Remove explicit loop from asyncio Queue + +In Python 3.5.3 and 3.6, the `get_event_loop` returned the expected +result always, so in Python 3.8, this parameter was deprecated and in +3.10 it was removed. +--- + distributed/actor.py | 7 ++++++- + distributed/tests/test_client.py | 18 ------------------ + 2 files changed, 6 insertions(+), 19 deletions(-) + +diff --git a/distributed/actor.py b/distributed/actor.py +index e99cac66b1..1dc16e1a58 100644 +--- a/distributed/actor.py ++++ b/distributed/actor.py +@@ -168,7 +168,12 @@ async def run_actor_function_on_worker(): + raise OSError("Unable to contact Actor's worker") + return result + +- q = asyncio.Queue(loop=self._io_loop.asyncio_loop) ++ loop = asyncio.get_event_loop() ++ try: ++ asyncio.set_event_loop(self._io_loop.asyncio_loop) ++ q = asyncio.Queue() ++ finally: ++ asyncio.set_event_loop(loop) + + async def wait_then_add_to_queue(): + x = await run_actor_function_on_worker() +diff --git a/distributed/tests/test_client.py b/distributed/tests/test_client.py +index 456485f0ca..88bf18b60f 100644 +--- a/distributed/tests/test_client.py ++++ b/distributed/tests/test_client.py +@@ -6301,24 +6301,6 @@ async def f(stacklevel, mode=None): + assert "cdn.bokeh.org" in data + + +-@gen_cluster(nthreads=[]) +-async def test_client_gather_semaphore_loop(s): +- async with Client(s.address, asynchronous=True) as c: +- assert c._gather_semaphore._loop is c.loop.asyncio_loop +- +- +-@gen_cluster(client=True) +-async def test_as_completed_condition_loop(c, s, a, b): +- seq = c.map(inc, range(5)) +- ac = as_completed(seq) +- assert ac.condition._loop == c.loop.asyncio_loop +- +- +-def test_client_connectionpool_semaphore_loop(s, a, b): +- with Client(s["address"]) as c: +- assert c.rpc.semaphore._loop is c.loop.asyncio_loop +- +- + @pytest.mark.slow + @gen_cluster(nthreads=[], timeout=60) + async def test_mixed_compression(s): diff --git a/python-distributed.changes b/python-distributed.changes index edc5137..236e092 100644 --- a/python-distributed.changes +++ b/python-distributed.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Jan 25 09:33:04 UTC 2022 - Dirk Müller + +- add distributed-fix-python310.patch to fix build with python 3.10 + ------------------------------------------------------------------- Thu Jan 20 16:09:54 UTC 2022 - Ben Greiner diff --git a/python-distributed.spec b/python-distributed.spec index 9ed6a18..bef6677 100644 --- a/python-distributed.spec +++ b/python-distributed.spec @@ -37,8 +37,6 @@ %bcond_without test %endif %if "%{flavor}" == "" -# https://github.com/dask/distributed/issues/5350 -%define skip_python310 1 %bcond_with test %endif @@ -64,6 +62,7 @@ License: BSD-3-Clause URL: https://distributed.readthedocs.io/en/latest/ Source: https://github.com/dask/distributed/archive/refs/tags//%{ghversiontag}.tar.gz#/distributed-%{ghversiontag}-gh.tar.gz Source99: python-distributed-rpmlintrc +Patch1: distributed-fix-python310.patch BuildRequires: %{python_module base >= 3.7} BuildRequires: %{python_module setuptools} BuildRequires: fdupes