From f3726dd716157c5c6fad935035f9c2b1063a9f4e Mon Sep 17 00:00:00 2001 From: crusaderky Date: Mon, 4 May 2026 10:08:59 +0100 Subject: [PATCH] Clean up Cython --- .gitignore | 4 ---- continuous_integration/environment-3.10.yaml | 1 - distributed/diagnostics/progress_stream.py | 13 ++++++------- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index b277ec7a166..77ba0b205b8 100644 --- a/.gitignore +++ b/.gitignore @@ -2,10 +2,6 @@ *.pyd *.py~ -# Cython files -*.c -*.so - build/ dist/ *.egg-info diff --git a/continuous_integration/environment-3.10.yaml b/continuous_integration/environment-3.10.yaml index 4ab79b4bda1..ba8207eb2d5 100644 --- a/continuous_integration/environment-3.10.yaml +++ b/continuous_integration/environment-3.10.yaml @@ -12,7 +12,6 @@ dependencies: - click - cloudpickle - coverage - - cython # Only tested here; also a dependency of crick - dask # overridden by git tip below; pulls in optional dependencies - fsspec - gilknocker diff --git a/distributed/diagnostics/progress_stream.py b/distributed/diagnostics/progress_stream.py index a9d7c40b10c..a5ec05ad2de 100644 --- a/distributed/diagnostics/progress_stream.py +++ b/distributed/diagnostics/progress_stream.py @@ -8,13 +8,14 @@ from distributed.core import coerce_to_address, connect from distributed.diagnostics.progress import AllProgress +from distributed.scheduler import Scheduler from distributed.utils import color_of from distributed.worker import dumps_function logger = logging.getLogger(__name__) -def counts(scheduler, allprogress): +def _counts(scheduler: Scheduler, allprogress: AllProgress) -> dict: return merge( {"all": valmap(len, allprogress.all), "nbytes": allprogress.nbytes}, { @@ -24,10 +25,8 @@ def counts(scheduler, allprogress): ) -def _remove_all_progress_plugin(self, *args, **kwargs): - # Wrapper function around `Scheduler.remove_plugin` to avoid raising a - # `PicklingError` when using a cythonized scheduler - self.remove_plugin(name=AllProgress.name) +def _teardown(scheduler: Scheduler, allprogress: AllProgress) -> None: + scheduler.remove_plugin(name=allprogress.name) async def progress_stream(address, interval): @@ -54,9 +53,9 @@ async def progress_stream(address, interval): { "op": "feed", "setup": dumps_function(AllProgress), - "function": dumps_function(counts), + "function": dumps_function(_counts), "interval": interval, - "teardown": dumps_function(_remove_all_progress_plugin), + "teardown": dumps_function(_teardown), } ) return comm