diff --git a/continuous_integration/environment-3.10.yaml b/continuous_integration/environment-3.10.yaml index ab5a2c91655..be9939b81c6 100644 --- a/continuous_integration/environment-3.10.yaml +++ b/continuous_integration/environment-3.10.yaml @@ -39,7 +39,7 @@ dependencies: - sortedcollections - tblib - toolz - - tornado<6.2 + - tornado >=6.2 - zict # overridden by git tip below - zstandard >=0.9.0 - pip: diff --git a/continuous_integration/environment-3.8.yaml b/continuous_integration/environment-3.8.yaml index 083a0722626..24c3cddec10 100644 --- a/continuous_integration/environment-3.8.yaml +++ b/continuous_integration/environment-3.8.yaml @@ -42,7 +42,7 @@ dependencies: - sortedcollections - tblib - toolz - - tornado<6.2 + - tornado >=6.2 - zict - zstandard >=0.9.0 - pip: diff --git a/continuous_integration/environment-3.9.yaml b/continuous_integration/environment-3.9.yaml index 77887b6bf1b..175dae3ec91 100644 --- a/continuous_integration/environment-3.9.yaml +++ b/continuous_integration/environment-3.9.yaml @@ -45,7 +45,7 @@ dependencies: - tblib - toolz - torchvision # Only tested here - - tornado<6.2 + - tornado >=6.2 - zict - zstandard >=0.9.0 - pip: diff --git a/continuous_integration/recipes/distributed/meta.yaml b/continuous_integration/recipes/distributed/meta.yaml index a171d751c9e..4c02eaa1d74 100644 --- a/continuous_integration/recipes/distributed/meta.yaml +++ b/continuous_integration/recipes/distributed/meta.yaml @@ -42,7 +42,7 @@ requirements: - sortedcontainers !=2.0.0,!=2.0.1 - tblib >=1.6.0 - toolz >=0.10.0 - - tornado >=6.0.3,<6.2 + - tornado >=6.0.3 - urllib3 - zict >=0.1.3 run_constrained: diff --git a/distributed/deploy/tests/test_adaptive.py b/distributed/deploy/tests/test_adaptive.py index d88615a7565..59ec50eaab8 100644 --- a/distributed/deploy/tests/test_adaptive.py +++ b/distributed/deploy/tests/test_adaptive.py @@ -281,6 +281,7 @@ async def test_no_more_workers_than_tasks(): @pytest.mark.filterwarnings("ignore:There is no current event loop:DeprecationWarning") +@pytest.mark.filterwarnings("ignore:make_current is deprecated:DeprecationWarning") def test_basic_no_loop(cleanup): loop = None try: diff --git a/distributed/deploy/tests/test_spec_cluster.py b/distributed/deploy/tests/test_spec_cluster.py index 31b95e28026..e0e7301fcf8 100644 --- a/distributed/deploy/tests/test_spec_cluster.py +++ b/distributed/deploy/tests/test_spec_cluster.py @@ -83,6 +83,7 @@ def test_spec_sync(loop): @pytest.mark.filterwarnings("ignore:There is no current event loop:DeprecationWarning") +@pytest.mark.filterwarnings("ignore:make_current is deprecated:DeprecationWarning") def test_loop_started_in_constructor(cleanup): # test that SpecCluster.__init__ starts a loop in another thread cluster = SpecCluster(worker_spec, scheduler=scheduler, loop=None) diff --git a/distributed/tests/test_client.py b/distributed/tests/test_client.py index 590fc13fd74..eadff34c3d4 100644 --- a/distributed/tests/test_client.py +++ b/distributed/tests/test_client.py @@ -77,14 +77,7 @@ from distributed.metrics import time from distributed.scheduler import CollectTaskMetaDataPlugin, KilledWorker, Scheduler from distributed.sizeof import sizeof -from distributed.utils import ( - NoOpAwaitable, - get_mp_context, - is_valid_xml, - open_port, - sync, - tmp_text, -) +from distributed.utils import get_mp_context, is_valid_xml, open_port, sync, tmp_text from distributed.utils_test import ( NO_AMM, BlockedGatherDep, @@ -2205,27 +2198,8 @@ async def test_multi_client(s, a, b): await asyncio.sleep(0.01) -@contextmanager -def _pristine_loop(): - IOLoop.clear_instance() - IOLoop.clear_current() - loop = IOLoop() - loop.make_current() - assert IOLoop.current() is loop - try: - yield loop - finally: - try: - loop.close(all_fds=True) - except (KeyError, ValueError): - pass - IOLoop.clear_instance() - IOLoop.clear_current() - - def long_running_client_connection(address): - with _pristine_loop(): - c = Client(address) + with Client(address) as c: x = c.submit(lambda x: x + 1, 10) x.result() sleep(100) @@ -2889,6 +2863,7 @@ async def test_startup_close_startup(s, a, b): @pytest.mark.filterwarnings("ignore:There is no current event loop:DeprecationWarning") +@pytest.mark.filterwarnings("ignore:make_current is deprecated:DeprecationWarning") def test_startup_close_startup_sync(loop): with cluster() as (s, [a, b]): with Client(s["address"], loop=loop) as c: @@ -5612,23 +5587,6 @@ async def test_future_auto_inform(c, s, a, b): await asyncio.sleep(0.01) -@pytest.mark.filterwarnings("ignore:There is no current event loop:DeprecationWarning") -def test_client_async_before_loop_starts(cleanup): - async def close(): - async with client: - pass - - with _pristine_loop() as loop: - with pytest.warns( - DeprecationWarning, - match=r"Constructing LoopRunner\(loop=loop\) without a running loop is deprecated", - ): - client = Client(asynchronous=True, loop=loop) - assert client.asynchronous - assert isinstance(client.close(), NoOpAwaitable) - loop.run_sync(close) # TODO: client.close() does not unset global client - - @pytest.mark.slow @gen_cluster(client=True, Worker=Nanny, timeout=60, nthreads=[("127.0.0.1", 3)] * 2) async def test_nested_compute(c, s, a, b): @@ -6924,6 +6882,7 @@ async def test_workers_collection_restriction(c, s, a, b): @pytest.mark.filterwarnings("ignore:There is no current event loop:DeprecationWarning") +@pytest.mark.filterwarnings("ignore:make_current is deprecated:DeprecationWarning") @gen_cluster(client=True, nthreads=[("127.0.0.1", 1)]) async def test_get_client_functions_spawn_clusters(c, s, a): # see gh4565 diff --git a/distributed/tests/test_client_loop.py b/distributed/tests/test_client_loop.py index 35bb3a7e861..9d8316cdd09 100644 --- a/distributed/tests/test_client_loop.py +++ b/distributed/tests/test_client_loop.py @@ -30,6 +30,7 @@ def _check_cluster_and_client_loop(loop): # Test if Client stops LoopRunner on close. @pytest.mark.filterwarnings("ignore:There is no current event loop:DeprecationWarning") +@pytest.mark.filterwarnings("ignore:make_current is deprecated:DeprecationWarning") def test_close_loop_sync_start_new_loop(cleanup): with _check_loop_runner(): _check_cluster_and_client_loop(loop=None) @@ -37,6 +38,7 @@ def test_close_loop_sync_start_new_loop(cleanup): # Test if Client stops LoopRunner on close. @pytest.mark.filterwarnings("ignore:There is no current event loop:DeprecationWarning") +@pytest.mark.filterwarnings("ignore:make_current is deprecated:DeprecationWarning") def test_close_loop_sync_use_running_loop(cleanup): with _check_loop_runner(): # Start own loop or use current thread's one. diff --git a/distributed/tests/test_utils.py b/distributed/tests/test_utils.py index 0f8a2e92ddc..685a0f1ed39 100644 --- a/distributed/tests/test_utils.py +++ b/distributed/tests/test_utils.py @@ -407,6 +407,7 @@ def assert_not_running(loop): @pytest.mark.filterwarnings("ignore:There is no current event loop:DeprecationWarning") +@pytest.mark.filterwarnings("ignore:make_current is deprecated:DeprecationWarning") def test_loop_runner(loop_in_thread): # Implicit loop loop = IOLoop() @@ -490,6 +491,7 @@ def test_loop_runner(loop_in_thread): @pytest.mark.filterwarnings("ignore:There is no current event loop:DeprecationWarning") +@pytest.mark.filterwarnings("ignore:make_current is deprecated:DeprecationWarning") def test_two_loop_runners(loop_in_thread): # Loop runners tied to the same loop should cooperate diff --git a/distributed/utils.py b/distributed/utils.py index c1d10920072..f3169e86eb2 100644 --- a/distributed/utils.py +++ b/distributed/utils.py @@ -436,12 +436,10 @@ def __init__(self, loop=None, asynchronous=False): if asynchronous: try: asyncio.get_running_loop() - except RuntimeError: - warnings.warn( - "Constructing a LoopRunner(asynchronous=True) without a running loop is deprecated", - DeprecationWarning, - stacklevel=2, - ) + except RuntimeError as e: + raise RuntimeError( + "Constructing a LoopRunner(asynchronous=True) without a running loop is not allowed" + ) from e self._loop = IOLoop.current() else: # We're expecting the loop to run in another thread, @@ -449,10 +447,8 @@ def __init__(self, loop=None, asynchronous=False): self._loop = IOLoop() else: if not loop.asyncio_loop.is_running(): - warnings.warn( - "Constructing LoopRunner(loop=loop) without a running loop is deprecated", - DeprecationWarning, - stacklevel=2, + raise RuntimeError( + "Constructing LoopRunner(loop=loop) without a running loop is not allowed" ) self._loop = loop self._asynchronous = asynchronous diff --git a/requirements.txt b/requirements.txt index e2c3fe1e274..9685ece5853 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,7 +9,7 @@ psutil >= 5.0 sortedcontainers !=2.0.0, !=2.0.1 tblib >= 1.6.0 toolz >= 0.10.0 -tornado >= 6.0.3, <6.2 +tornado >= 6.0.3 urllib3 zict >= 0.1.3 pyyaml