From f9371baa0761dbab23ac3c820d86c0eef7867ee3 Mon Sep 17 00:00:00 2001 From: crusaderky Date: Tue, 8 Feb 2022 16:31:30 +0000 Subject: [PATCH 1/2] Remove ncores --- distributed/nanny.py | 5 ----- distributed/scheduler.py | 5 ----- distributed/tests/test_worker.py | 1 - distributed/utils_test.py | 5 ----- distributed/worker.py | 12 +++--------- 5 files changed, 3 insertions(+), 25 deletions(-) diff --git a/distributed/nanny.py b/distributed/nanny.py index cfd09f55ffe..4c43df1ddf2 100644 --- a/distributed/nanny.py +++ b/distributed/nanny.py @@ -88,7 +88,6 @@ def __init__( scheduler_file=None, worker_port=0, nthreads=None, - ncores=None, loop=None, local_dir=None, local_directory=None, @@ -172,10 +171,6 @@ def __init__( if len(protocol_address) == 2: protocol = protocol_address[0] - if ncores is not None: - warnings.warn("the ncores= parameter has moved to nthreads=") - nthreads = ncores - self._given_worker_port = worker_port self.nthreads = nthreads or CPU_COUNT self.reconnect = reconnect diff --git a/distributed/scheduler.py b/distributed/scheduler.py index 2a03002c64f..471382f4670 100644 --- a/distributed/scheduler.py +++ b/distributed/scheduler.py @@ -787,11 +787,6 @@ def identity(self) -> dict: **self._extra, } - @property - def ncores(self): - warnings.warn("WorkerState.ncores has moved to WorkerState.nthreads") - return self._nthreads - @final @cclass diff --git a/distributed/tests/test_worker.py b/distributed/tests/test_worker.py index 6ad29293cc7..21ecd4ef074 100644 --- a/distributed/tests/test_worker.py +++ b/distributed/tests/test_worker.py @@ -3461,7 +3461,6 @@ async def test_Worker__to_dict(c, s, a): "id", "scheduler", "nthreads", - "ncores", "memory_limit", "address", "status", diff --git a/distributed/utils_test.py b/distributed/utils_test.py index 1632322b334..3322de7a90d 100644 --- a/distributed/utils_test.py +++ b/distributed/utils_test.py @@ -20,7 +20,6 @@ import tempfile import threading import uuid -import warnings import weakref from collections import defaultdict from collections.abc import Callable @@ -883,7 +882,6 @@ def gen_cluster( ("127.0.0.1", 1), ("127.0.0.1", 2), ], - ncores: None = None, # deprecated scheduler="127.0.0.1", timeout: float = _TEST_TIMEOUT, security: Security | dict[str, Any] | None = None, @@ -923,9 +921,6 @@ async def test_foo(scheduler, worker1, worker2, pytest_fixture_a, pytest_fixture "timeout should always be set and it should be smaller than the global one from" "pytest-timeout" ) - if ncores is not None: - warnings.warn("ncores= has moved to nthreads=", stacklevel=2) - nthreads = ncores scheduler_kwargs = merge( {"dashboard": False, "dashboard_address": ":0"}, scheduler_kwargs diff --git a/distributed/worker.py b/distributed/worker.py index baa2fab5576..923f313b5e7 100644 --- a/distributed/worker.py +++ b/distributed/worker.py @@ -608,7 +608,6 @@ def __init__( scheduler_port: int | None = None, *, scheduler_file: str | None = None, - ncores: None = None, # Deprecated, use nthreads instead nthreads: int | None = None, loop: IOLoop | None = None, local_dir: None = None, # Deprecated, use local_directory instead @@ -837,10 +836,6 @@ def __init__( self._interface = interface self._protocol = protocol - if ncores is not None: - warnings.warn("the ncores= parameter has moved to nthreads=") - nthreads = ncores - self.nthreads = nthreads or CPU_COUNT if resources is None: resources = dask.config.get("distributed.worker.resources", None) @@ -1184,7 +1179,6 @@ def identity(self, comm=None): "id": self.id, "scheduler": self.scheduler.address, "nthreads": self.nthreads, - "ncores": self.nthreads, # backwards compatibility "memory_limit": self.memory_limit, } @@ -2909,7 +2903,7 @@ def total_comm_bytes(self): warnings.warn( "The attribute `Worker.total_comm_bytes` has been renamed to `comm_threshold_bytes`. " "Future versions will only support the new name.", - DeprecationWarning, + FutureWarning, ) return self.comm_threshold_bytes @@ -3880,11 +3874,11 @@ def _notify_plugins(self, method_name, *args, **kwargs): if hasattr(plugin, method_name): if method_name == "release_key": warnings.warn( - "The `WorkerPlugin.release_key` hook is depreacted and will be " + "The `WorkerPlugin.release_key` hook is deprecated and will be " "removed in a future version. A similar event can now be " "caught by filtering for a `finish=='released'` event in the " "`WorkerPlugin.transition` hook.", - DeprecationWarning, + FutureWarning, ) try: From 94ed3d1d102bdaeb186b2a1d666744ef37c02e7e Mon Sep 17 00:00:00 2001 From: crusaderky Date: Tue, 8 Feb 2022 23:51:39 +0000 Subject: [PATCH 2/2] fix test --- distributed/diagnostics/tests/test_worker_plugin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/distributed/diagnostics/tests/test_worker_plugin.py b/distributed/diagnostics/tests/test_worker_plugin.py index f740c8d3fcc..f64e10b1c28 100644 --- a/distributed/diagnostics/tests/test_worker_plugin.py +++ b/distributed/diagnostics/tests/test_worker_plugin.py @@ -247,8 +247,8 @@ def teardown(self, worker): await c.register_worker_plugin(ReleaseKeyDeprecated()) - with pytest.deprecated_call( - match="The `WorkerPlugin.release_key` hook is depreacted" + with pytest.warns( + FutureWarning, match="The `WorkerPlugin.release_key` hook is deprecated" ): assert await c.submit(inc, 1, key="x") == 2 while "x" in a.tasks: