diff --git a/cluster_tools/Changelog.md b/cluster_tools/Changelog.md index 3a43bcdda..bb7eaefea 100644 --- a/cluster_tools/Changelog.md +++ b/cluster_tools/Changelog.md @@ -10,8 +10,10 @@ For upgrade instructions, please check the respective *Breaking Changes* section [Commits](https://github.com/scalableminds/webknossos-libs/compare/v0.13.6...HEAD) ### Breaking Changes +- Dropped support for Python 3.7. [#943](https://github.com/scalableminds/webknossos-libs/pull/943) ### Added +- Added `DaskScheduler` (only Python >= 3.9). [#943](https://github.com/scalableminds/webknossos-libs/pull/943) ### Changed diff --git a/cluster_tools/cluster_tools/__init__.py b/cluster_tools/cluster_tools/__init__.py index 3fb424d5b..776723548 100644 --- a/cluster_tools/cluster_tools/__init__.py +++ b/cluster_tools/cluster_tools/__init__.py @@ -110,7 +110,10 @@ def get_executor(environment: str, **kwargs: Any) -> "Executor": elif environment == "kubernetes": return KubernetesExecutor(**kwargs) elif environment == "dask": - return DaskExecutor(**kwargs) + if "client" in kwargs: + return DaskExecutor(kwargs["client"]) + else: + return DaskExecutor.from_kwargs(**kwargs) elif environment == "multiprocessing": global did_start_test_multiprocessing if not did_start_test_multiprocessing: diff --git a/cluster_tools/cluster_tools/executors/dask.py b/cluster_tools/cluster_tools/executors/dask.py index e7695b251..1173cff03 100644 --- a/cluster_tools/cluster_tools/executors/dask.py +++ b/cluster_tools/cluster_tools/executors/dask.py @@ -32,11 +32,18 @@ class DaskExecutor(futures.Executor): def __init__( self, - **kwargs: Any, + client: "Client", ) -> None: + self.client = client + + @classmethod + def from_kwargs( + cls, + **kwargs: Any, + ) -> "DaskExecutor": from distributed import Client - self.client = Client(**kwargs) + return cls(Client(**kwargs)) @classmethod def as_completed(cls, futures: List["Future[_T]"]) -> Iterator["Future[_T]"]: diff --git a/webknossos/Changelog.md b/webknossos/Changelog.md index 3b7d6bd0e..9b1f5ef51 100644 --- a/webknossos/Changelog.md +++ b/webknossos/Changelog.md @@ -17,6 +17,7 @@ For upgrade instructions, please check the respective _Breaking Changes_ section ### Added ### Changed +- Updates various dependencies. [#943](https://github.com/scalableminds/webknossos-libs/pull/943) ### Fixed - Fixed a bug in writing compressed data. [#942](https://github.com/scalableminds/webknossos-libs/pull/942)