diff --git a/distributed/diagnostics/progress.py b/distributed/diagnostics/progress.py index 1712cc5df3..8bcd60b0e1 100644 --- a/distributed/diagnostics/progress.py +++ b/distributed/diagnostics/progress.py @@ -2,7 +2,6 @@ import asyncio import logging -import warnings from collections import defaultdict from timeit import default_timer from typing import ClassVar @@ -10,6 +9,7 @@ from tlz import groupby, valmap from dask.tokenize import tokenize +from dask.typing import Key from dask.utils import key_split from distributed.diagnostics.plugin import SchedulerPlugin @@ -147,48 +147,31 @@ class MultiProgress(Progress): Parameters ---------- - - func : Callable (deprecated) - Function that splits keys. This defaults to ``key_split`` which - aligns with naming conventions chosen in the dask project (tuples, - hyphens, etc..) - - group_by : Callable | Literal["spans"] | Literal["prefix"], default: "prefix" + group_by : Callable | Literal["spans", "prefix"], default: "prefix" How to group keys to display multiple bars. Defaults to "prefix", which uses ``key_split`` from dask project - State - ----- + Attributes + ---------- keys: dict Maps group name to set of not-yet-complete keys for that group all_keys: dict Maps group name to set of all keys for that group - - Examples - -------- - >>> split = lambda s: s.split('-')[0] - >>> p = MultiProgress(['y-2'], func=split) # doctest: +SKIP - >>> p.keys # doctest: +SKIP - {'x': {'x-1', 'x-2', 'x-3'}, - 'y': {'y-1', 'y-2'}} """ + keys: dict[str, set[Key]] + all_keys: dict[str, set[Key]] + def __init__( self, keys, scheduler=None, *, - func=None, group_by="prefix", minimum=0, dt=0.1, complete=False, ): - if func is not None: - warnings.warn( - "`func` is deprecated, use `group_by`", category=DeprecationWarning - ) - group_by = func self.group_by = key_split if group_by in (None, "prefix") else group_by self.func = None name = f"multi-progress-{tokenize(keys, group_by, minimum, dt, complete)}" diff --git a/distributed/diagnostics/progressbar.py b/distributed/diagnostics/progressbar.py index 86fc3226ec..dd20f4a259 100644 --- a/distributed/diagnostics/progressbar.py +++ b/distributed/diagnostics/progressbar.py @@ -238,7 +238,6 @@ def __init__( keys, scheduler=None, *, - func=None, group_by="prefix", interval="100ms", complete=False, @@ -252,13 +251,7 @@ def __init__( self.client = weakref.ref(key.client) break - if func is not None: - warnings.warn( - "`func` is deprecated, use `group_by` instead", - category=DeprecationWarning, - ) - group_by = func - elif group_by in (None, "prefix"): + if group_by in (None, "prefix"): group_by = key_split self.keys = {k.key if hasattr(k, "key") else k for k in keys} @@ -477,11 +470,6 @@ def progress( futures = [futures] if notebook is None: notebook = is_kernel() # often but not always correct assumption - if kwargs.get("func", None) is not None: - warnings.warn( - "`func` is deprecated, use `group_by` instead", category=DeprecationWarning - ) - group_by = kwargs.pop("func") if group_by not in ("spans", "prefix") and not isinstance(group_by, Callable): raise ValueError("`group_by` should be 'spans', 'prefix', or a Callable") if notebook: diff --git a/distributed/diagnostics/tests/test_progress.py b/distributed/diagnostics/tests/test_progress.py index 7be880088c..eaab6d0354 100644 --- a/distributed/diagnostics/tests/test_progress.py +++ b/distributed/diagnostics/tests/test_progress.py @@ -119,12 +119,6 @@ async def test_multiprogress_with_prefix(c, s, a, b): assert group_names == {"inc"} -def test_multiprogress_warns(): - with pytest.warns(DeprecationWarning, match="func` is deprecated, use `group_by"): - p = MultiProgress([], complete=True, func="spans") - assert p.group_by == "spans" - - @gen_cluster(client=True) async def test_robust_to_bad_plugin(c, s, a, b): class Bad(SchedulerPlugin): diff --git a/distributed/diagnostics/tests/test_progress_widgets.py b/distributed/diagnostics/tests/test_progress_widgets.py index bdd9ac9f48..224c718ea0 100644 --- a/distributed/diagnostics/tests/test_progress_widgets.py +++ b/distributed/diagnostics/tests/test_progress_widgets.py @@ -5,8 +5,6 @@ import pytest -from dask.utils import key_split - from distributed.client import wait from distributed.spans import span from distributed.utils_test import dec, gen_cluster, gen_tls_cluster, inc, throws @@ -188,22 +186,6 @@ def test_multibar_with_spans(client): assert all(f">{k}<" in v for k, v in bar_labels.items()) -def test_multibar_func_warns(client): - """Deprecate `func`, use `group_by`""" - L = client.map(inc, range(100)) - L2 = client.map(dec, L) - L3 = client.map(add, L, L2) - - # ensure default value if nothing is set - p = MultiProgressWidget(L3) - assert p.group_by == key_split - - with pytest.warns( - DeprecationWarning, match="`func` is deprecated, use `group_by` instead" - ): - MultiProgressWidget(L3, func="foo") - - @gen_cluster(client=True, client_kwargs={"serializers": ["msgpack"]}) async def test_serializers(c, s, a, b): x = c.submit(inc, 1) diff --git a/distributed/diagnostics/tests/test_progressbar.py b/distributed/diagnostics/tests/test_progressbar.py index 7874457a2c..82655a45bf 100644 --- a/distributed/diagnostics/tests/test_progressbar.py +++ b/distributed/diagnostics/tests/test_progressbar.py @@ -77,11 +77,6 @@ def test_progress_function_w_kwargs(client, capsys): check_bar_completed(capsys) -def test_progress_function_warns(client): - with pytest.warns(DeprecationWarning, match="`func` is deprecated"): - progress(None, func="prefix") - - def test_progress_function_raises(): with pytest.raises(ValueError, match="`group_by` should be "): progress(None, group_by="incorrect")