Skip to content

Commit

Permalink
Remove deprecation in wait_for_workers
Browse files Browse the repository at this point in the history
  • Loading branch information
crusaderky committed Sep 18, 2023
1 parent a6d63dc commit 1044952
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 31 deletions.
14 changes: 2 additions & 12 deletions distributed/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}."
)
Expand Down
12 changes: 2 additions & 10 deletions distributed/deploy/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}."
)
Expand Down
9 changes: 0 additions & 9 deletions distributed/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
[
Expand Down

0 comments on commit 1044952

Please sign in to comment.