From 1044952012d1fe2cf89ce72f7939f16d1351ef54 Mon Sep 17 00:00:00 2001 From: crusaderky Date: Mon, 18 Sep 2023 15:16:09 +0100 Subject: [PATCH] Remove deprecation in wait_for_workers --- distributed/client.py | 14 ++------------ distributed/deploy/cluster.py | 12 ++---------- distributed/tests/test_client.py | 9 --------- 3 files changed, 4 insertions(+), 31 deletions(-) diff --git a/distributed/client.py b/distributed/client.py index 0be88cf33d2..d02327ca9e5 100644 --- a/distributed/client.py +++ b/distributed/client.py @@ -1437,11 +1437,7 @@ def running_workers(info): info = await self.scheduler.identity() self._scheduler_identity = SchedulerInfo(info) - def wait_for_workers( - self, - n_workers: int | str = no_default, - timeout: float | None = None, - ) -> None: + def wait_for_workers(self, n_workers: int, timeout: float | None = None) -> None: """Blocking call to wait for n workers before continuing Parameters @@ -1452,13 +1448,7 @@ def wait_for_workers( Time in seconds after which to raise a ``dask.distributed.TimeoutError`` """ - if n_workers is no_default: - warnings.warn( - "Please specify the `n_workers` argument when using `Client.wait_for_workers`. Not specifying `n_workers` will no longer be supported in future versions.", - FutureWarning, - ) - n_workers = 0 - elif not isinstance(n_workers, int) or n_workers < 1: + if not isinstance(n_workers, int) or n_workers < 1: raise ValueError( f"`n_workers` must be a positive integer. Instead got {n_workers}." ) diff --git a/distributed/deploy/cluster.py b/distributed/deploy/cluster.py index 09c2ed0de5d..514b97458bd 100644 --- a/distributed/deploy/cluster.py +++ b/distributed/deploy/cluster.py @@ -621,9 +621,7 @@ def running_workers(info): self.scheduler_info = SchedulerInfo(await self.scheduler_comm.identity()) - def wait_for_workers( - self, n_workers: int | str = no_default, timeout: float | None = None - ) -> None: + def wait_for_workers(self, n_workers: int, timeout: float | None = None) -> None: """Blocking call to wait for n workers before continuing Parameters @@ -634,13 +632,7 @@ def wait_for_workers( Time in seconds after which to raise a ``dask.distributed.TimeoutError`` """ - if n_workers is no_default: - warnings.warn( - "Please specify the `n_workers` argument when using `Client.wait_for_workers`. Not specifying `n_workers` will no longer be supported in future versions.", - FutureWarning, - ) - n_workers = 0 - elif not isinstance(n_workers, int) or n_workers < 1: + if not isinstance(n_workers, int) or n_workers < 1: raise ValueError( f"`n_workers` must be a positive integer. Instead got {n_workers}." ) diff --git a/distributed/tests/test_client.py b/distributed/tests/test_client.py index c855a6a9484..c44d32a8d24 100644 --- a/distributed/tests/test_client.py +++ b/distributed/tests/test_client.py @@ -8387,15 +8387,6 @@ class MyException(Exception): assert (stop - start) < 2 -@gen_cluster(client=True, nthreads=[]) -async def test_wait_for_workers_no_default(c, s): - with pytest.warns( - FutureWarning, - match="specify the `n_workers` argument when using `Client.wait_for_workers`", - ): - await c.wait_for_workers() - - @pytest.mark.parametrize( "value, exception", [