Skip to content

Commit 7a8764a

Browse files
committed
Merge branch 'master' of github.com:scalableminds/webknossos-libs
2 parents 79bf710 + 84461f4 commit 7a8764a

File tree

103 files changed

+4893
-2282
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+4893
-2282
lines changed

.codespellrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[codespell]
2+
# Ref: https://github.com/codespell-project/codespell#using-a-config-file
3+
skip = *.lock,./webknossos/tests/cassettes,./webknossos/tests/dataset/cassettes,./webknossos/webknossos/dataset/_utils/vendor
4+
# some names and camelCased variables etc
5+
ignore-regex = \b([a-z]+[A-Z][a-zA-Z]*)\b
6+
ignore-words-list = nd,ND

.github/workflows/ci.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,22 @@ jobs:
8484
./kind create cluster --config=tests/cluster-config.yaml
8585
./kind export kubeconfig
8686
87+
cp ../requirements.txt .
8788
docker build -f tests/Dockerfile -t scalableminds/cluster-tools:latest .
8889
./kind load docker-image scalableminds/cluster-tools:latest
8990
9091
- name: Install dependencies (without docker)
91-
if: ${{ matrix.executors != 'slurm' }}
92+
if: ${{ matrix.executors == 'multiprocessing' }}
9293
run: |
9394
pip install -r ../requirements.txt
9495
poetry install
9596
97+
- name: Install dependencies (without docker)
98+
if: ${{ matrix.executors == 'kubernetes' || matrix.executors == 'dask' }}
99+
run: |
100+
pip install -r ../requirements.txt
101+
poetry install --all-extras
102+
96103
- name: Check typing
97104
if: ${{ matrix.executors == 'multiprocessing' && matrix.python-version == '3.11' }}
98105
run: ./typecheck.sh
@@ -163,7 +170,7 @@ jobs:
163170
- name: Install dependencies
164171
run: |
165172
pip install -r ../requirements.txt
166-
poetry install --extras all --with examples
173+
poetry install --extras all --with examples --with dev
167174
168175
- name: Check formatting
169176
if: ${{ matrix.group == 1 && matrix.python-version == '3.11' }}

.github/workflows/nightly.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Install dependencies
3030
run: |
3131
pip install poetry
32-
poetry install --extras all
32+
poetry install --extras all --with examples --with dev
3333
3434
- name: Check if git is dirty
3535
run: |

CONTRIBUTING.md

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ See below for specifics of the different packages. Let's have a look at the comm
115115
To install the dependencies for all sub-projects, run `make install`.
116116

117117
* **Tooling** we use across the sub-projects to enforce coding styles and tests:
118-
* `./format.sh`: black and isort
119-
* `./lint.sh`: pylint
118+
* `./format.sh`: ruff
119+
* `./lint.sh`: ruff
120120
* `./typecheck.sh`: mypy
121121
* `./test.sh`: pytest and custom scripts
122122

@@ -147,15 +147,6 @@ The tests also contain functionality for the WEBKNOSSOS client. There a two mode
147147
[`pytest-split`](https://jerry-git.github.io/pytest-split),
148148
which is used in the CI to split the tests for different runners.
149149

150-
The code under `webknossos/client/_generated` is auto-generated! Please don't adapt anything in the `generated` folder manually, but re-run the code generation.
151-
152-
The client code is generated using [openapi-python-client](https://github.com/openapi-generators/openapi-python-client) and [InducOapi](https://github.com/TheWall89/inducoapi).
153-
154-
To re-generate the code, run
155-
```bash
156-
./generate_client.sh
157-
```
158-
159150
#### `cluster_tools` package
160151

161152
For testing the `slurm` setup a docker-compose setup is available. Please see the [respective Readme](https://github.com/scalableminds/webknossos-libs/blob/master/cluster_tools/README.md) for details.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![Supported Python Versions](https://img.shields.io/pypi/pyversions/webknossos.svg)](https://pypi.python.org/pypi/webknossos)
44
[![Build Status](https://img.shields.io/github/actions/workflow/status/scalableminds/webknossos-libs/.github/workflows/ci.yml?branch=master)](https://github.com/scalableminds/webknossos-libs/actions?query=workflow%3A%22CI%22)
55
[![Documentation](https://img.shields.io/badge/docs-passing-brightgreen.svg)](https://docs.webknossos.org/webknossos-py/index.html)
6-
[![Code Style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
6+
[![Code Style](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://docs.astral.sh/ruff/)
77

88
<img align="right" src="https://static.webknossos.org/logos/webknossos-icon-only.svg" alt="WEBKNOSSOS Logo" width="100" height="100"/>
99

cluster_tools/Changelog.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/) `MAJOR.MIN
77
For upgrade instructions, please check the respective *Breaking Changes* sections.
88

99
## Unreleased
10-
[Commits](https://github.com/scalableminds/webknossos-libs/compare/v0.14.15...HEAD)
10+
[Commits](https://github.com/scalableminds/webknossos-libs/compare/v0.14.22...HEAD)
1111

1212
### Breaking Changes
1313

@@ -18,6 +18,44 @@ For upgrade instructions, please check the respective *Breaking Changes* section
1818
### Fixed
1919

2020

21+
## [0.14.22](https://github.com/scalableminds/webknossos-libs/releases/tag/v0.14.22) - 2024-05-13
22+
[Commits](https://github.com/scalableminds/webknossos-libs/compare/v0.14.21...v0.14.22)
23+
24+
25+
## [0.14.21](https://github.com/scalableminds/webknossos-libs/releases/tag/v0.14.21) - 2024-05-07
26+
[Commits](https://github.com/scalableminds/webknossos-libs/compare/v0.14.20...v0.14.21)
27+
28+
29+
## [0.14.20](https://github.com/scalableminds/webknossos-libs/releases/tag/v0.14.20) - 2024-04-23
30+
[Commits](https://github.com/scalableminds/webknossos-libs/compare/v0.14.19...v0.14.20)
31+
32+
### Changed
33+
- Array jobs are spawned faster now, because common meta data is not serialized for each subjob. The performance improvement is especially big, when custom logging code is configured for array jobs. [#1042](https://github.com/scalableminds/webknossos-libs/pull/1042)
34+
- Updated ruff to v0.4.0 [1047](https://github.com/scalableminds/webknossos-libs/pull/1047)
35+
36+
37+
## [0.14.19](https://github.com/scalableminds/webknossos-libs/releases/tag/v0.14.19) - 2024-04-18
38+
[Commits](https://github.com/scalableminds/webknossos-libs/compare/v0.14.18...v0.14.19)
39+
40+
### Changed
41+
- Moved the dependencies for Kubernetes and Dask support into optional extras that need to be installed separately. Either with `poetry install --all-extras or pip install -e "all"`. [#1024](https://github.com/scalableminds/webknossos-libs/pull/1024)
42+
43+
44+
## [0.14.18](https://github.com/scalableminds/webknossos-libs/releases/tag/v0.14.18) - 2024-04-18
45+
[Commits](https://github.com/scalableminds/webknossos-libs/compare/v0.14.17...v0.14.18)
46+
47+
48+
## [0.14.17](https://github.com/scalableminds/webknossos-libs/releases/tag/v0.14.17) - 2024-04-10
49+
[Commits](https://github.com/scalableminds/webknossos-libs/compare/v0.14.16...v0.14.17)
50+
51+
52+
## [0.14.16](https://github.com/scalableminds/webknossos-libs/releases/tag/v0.14.16) - 2024-04-04
53+
[Commits](https://github.com/scalableminds/webknossos-libs/compare/v0.14.15...v0.14.16)
54+
55+
### Changed
56+
- Replaced black+isort formatters and pylint linter with ruff. [#1023](https://github.com/scalableminds/webknossos-libs/pull/1023)
57+
58+
2159
## [0.14.15](https://github.com/scalableminds/webknossos-libs/releases/tag/v0.14.15) - 2024-02-07
2260
[Commits](https://github.com/scalableminds/webknossos-libs/compare/v0.14.14...v0.14.15)
2361

cluster_tools/README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# Cluster Tools
22

33
[![Build Status](https://img.shields.io/github/actions/workflow/status/scalableminds/webknossos-libs/.github/workflows/ci.yml?branch=master)](https://github.com/scalableminds/webknossos-libs/actions?query=workflow%3A%22CI%22)
4+
[![Code Style](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://docs.astral.sh/ruff/)
45

5-
This package provides python `Executor` classes for distributing tasks on a slurm cluster or via multi processing.
6+
7+
This package provides python `Executor` classes for distributing tasks on a Slurm cluster, Kubernetes, Dask or via multi processing.
68

79
## Example
810

@@ -19,6 +21,23 @@ if __name__ == '__main__':
1921
assert result == [4, 9, 16]
2022
```
2123

24+
## Installation
25+
The `cluster_tools` package requires at least Python 3.8.
26+
27+
You can install it from [pypi](https://pypi.org/project/cluster_tools/), e.g. via pip:
28+
29+
```bash
30+
pip install cluster_tools
31+
```
32+
33+
By default only the dependencies for running jobs on Slurm and via multiprocessing are installed.
34+
For Kubernetes and Dask run:
35+
36+
```bash
37+
pip install cluster_tools[kubernetes]
38+
pip install cluster_tools[dask]
39+
```
40+
2241
## Configuration
2342

2443
### Slurm
@@ -55,12 +74,15 @@ If you would like to configure these limits independently, you can do so by sett
5574
## Dev Setup
5675

5776
```
77+
# See ./dockered-slurm/README.md for troubleshooting
5878
cd dockered-slurm
5979
docker-compose up -d
6080
docker exec -it slurmctld bash
6181
docker exec -it c1 bash
6282
```
6383

84+
Make sure to install all extra dependencies, such as Kubernetes, with `poetry install --all-extras`.
85+
6486
Tests can be executed with `cd tests && poetry run pytest -s tests.py` after entering the container.
6587
Linting can be run with `./lint.sh`.
6688
Code formatting (black) can be run with `./format.sh`.

cluster_tools/cluster_tools/__init__.py

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
from cluster_tools.executors.pickle_ import PickleExecutor
88
from cluster_tools.executors.sequential import SequentialExecutor
99
from cluster_tools.schedulers.cluster_executor import (
10-
ClusterExecutor,
11-
RemoteOutOfMemoryException,
12-
RemoteResourceLimitException,
13-
RemoteTimeLimitException,
10+
ClusterExecutor, # noqa: F401 `cluster_tools.schedulers.cluster_executor.ClusterExecutor` imported but unused;
11+
RemoteOutOfMemoryException, # noqa: F401 `cluster_tools.schedulers.cluster_executor.ClusterExecutor` imported but unused;
12+
RemoteResourceLimitException, # noqa: F401 `cluster_tools.schedulers.cluster_executor.ClusterExecutor` imported but unused;
13+
RemoteTimeLimitException, # noqa: F401 `cluster_tools.schedulers.cluster_executor.ClusterExecutor` imported but unused;
1414
)
1515
from cluster_tools.schedulers.kube import KubernetesExecutor
1616
from cluster_tools.schedulers.pbs import PBSExecutor
@@ -54,53 +54,45 @@ def _test_valid_multiprocessing() -> None:
5454

5555

5656
@overload
57-
def get_executor(environment: Literal["slurm"], **kwargs: Any) -> SlurmExecutor:
58-
...
57+
def get_executor(environment: Literal["slurm"], **kwargs: Any) -> SlurmExecutor: ...
5958

6059

6160
@overload
62-
def get_executor(environment: Literal["pbs"], **kwargs: Any) -> PBSExecutor:
63-
...
61+
def get_executor(environment: Literal["pbs"], **kwargs: Any) -> PBSExecutor: ...
6462

6563

6664
@overload
6765
def get_executor(
6866
environment: Literal["kubernetes"], **kwargs: Any
69-
) -> KubernetesExecutor:
70-
...
67+
) -> KubernetesExecutor: ...
7168

7269

7370
@overload
74-
def get_executor(environment: Literal["dask"], **kwargs: Any) -> DaskExecutor:
75-
...
71+
def get_executor(environment: Literal["dask"], **kwargs: Any) -> DaskExecutor: ...
7672

7773

7874
@overload
7975
def get_executor(
8076
environment: Literal["multiprocessing"], **kwargs: Any
81-
) -> MultiprocessingExecutor:
82-
...
77+
) -> MultiprocessingExecutor: ...
8378

8479

8580
@overload
8681
def get_executor(
8782
environment: Literal["sequential"], **kwargs: Any
88-
) -> SequentialExecutor:
89-
...
83+
) -> SequentialExecutor: ...
9084

9185

9286
@overload
9387
def get_executor(
9488
environment: Literal["debug_sequential"], **kwargs: Any
95-
) -> DebugSequentialExecutor:
96-
...
89+
) -> DebugSequentialExecutor: ...
9790

9891

9992
@overload
10093
def get_executor(
10194
environment: Literal["test_pickling"], **kwargs: Any
102-
) -> PickleExecutor:
103-
...
95+
) -> PickleExecutor: ...
10496

10597

10698
def get_executor(environment: str, **kwargs: Any) -> "Executor":

cluster_tools/cluster_tools/_utils/call.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ def call(command: str, stdin: Optional[str] = None) -> Tuple[str, str, int]:
2525
class CommandError(Exception):
2626
"""Raised when a shell command exits abnormally."""
2727

28-
def __init__(
29-
self, command: str, code: int, stderr: str
30-
): # pylint: disable=super-init-not-called
28+
def __init__(self, command: str, code: int, stderr: str):
3129
self.command = command
3230
self.code = code
3331
self.stderr = stderr

cluster_tools/cluster_tools/_utils/multiprocessing_logging_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def _receive(self) -> None:
5252
record = self.queue.get(timeout=0.2)
5353
if record is not None:
5454
self.wrapped_handler.emit(record)
55-
except (KeyboardInterrupt, SystemExit): # pylint: disable=try-except-raise
55+
except (KeyboardInterrupt, SystemExit):
5656
raise
5757
# The following errors pop up quite often.
5858
# It seems that they can be safely ignored, though.

0 commit comments

Comments
 (0)