Skip to content

Commit

Permalink
changelog and DaskExecutor.from_kwargs
Browse files Browse the repository at this point in the history
  • Loading branch information
normanrz committed Sep 26, 2023
1 parent ac883bd commit 1bed47e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
2 changes: 2 additions & 0 deletions cluster_tools/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 4 additions & 1 deletion cluster_tools/cluster_tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
11 changes: 9 additions & 2 deletions cluster_tools/cluster_tools/executors/dask.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]"]:
Expand Down
1 change: 1 addition & 0 deletions webknossos/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1bed47e

Please sign in to comment.