Skip to content

[pre-commit.ci] pre-commit autoupdate #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@ repos:
rev: v4.4.0
hooks:
- id: check-added-large-files
args: ['--maxkb=100']
args: ['--maxkb=25']
- id: check-case-conflict
- id: check-merge-conflict
- id: check-vcs-permalinks
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: no-commit-to-branch
args: [--branch, main]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0 # Use the ref you want to point at
hooks:
Expand All @@ -26,21 +32,16 @@ repos:
rev: v2.2.0
hooks:
- id: setup-cfg-fmt
- repo: https://github.com/PYCQA/docformatter
rev: v1.5.1
hooks:
- id: docformatter
args: [--in-place, --wrap-summaries, "88", --wrap-descriptions, "88", --blank]
- repo: https://github.com/psf/black
rev: 22.12.0
rev: 23.3.0
hooks:
- id: black
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.223
rev: v0.0.261
hooks:
- id: ruff
- repo: https://github.com/dosisod/refurb
rev: v1.10.0
rev: v1.15.0
hooks:
- id: refurb
args: [--ignore, FURB126]
Expand All @@ -59,11 +60,11 @@ repos:
]
args: [--wrap, "88"]
- repo: https://github.com/codespell-project/codespell
rev: v2.2.2
rev: v2.2.4
hooks:
- id: codespell
- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v0.991'
rev: 'v1.2.0'
hooks:
- id: mypy
args: [
Expand Down
4 changes: 3 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ chronological order. Releases follow [semantic versioning](https://semver.org/)
releases are available on [PyPI](https://pypi.org/project/pytask-parallel) and
[Anaconda.org](https://anaconda.org/conda-forge/pytask-parallel).

## 0.3.0 - 2023-xx-xx
## 0.3.1 - 2023-xx-xx

## 0.3.0 - 2023-01-23

- {pull}`50` deprecates INI configurations and aligns the package with pytask v0.3.
- {pull}`51` adds ruff and refurb.
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ target-version = "py37"
select = ["ALL"]
fix = true
extend-ignore = [
"TRY", # ignore tryceratops.
"TCH", # ignore non-guarded type imports.
# Numpy docstyle
"D107",
"D203",
Expand All @@ -52,6 +54,8 @@ extend-ignore = [
"ANN401", # flake8-annotate typing.Any
"PD", # pandas-vet
"COM812", # trailing comma missing, but black takes care of that
"D401", # imperative mood for first line. too many false-positives.
"SLF001", # access private members.
]


Expand Down
2 changes: 1 addition & 1 deletion src/pytask_parallel/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
@hookimpl
def pytask_parse_config(config: dict[str, Any]) -> None:
"""Parse the configuration."""
if config["n_workers"] == "auto": # noqa: PLR2004
if config["n_workers"] == "auto":
config["n_workers"] = max(os.cpu_count() - 1, 1)

if (
Expand Down
6 changes: 2 additions & 4 deletions src/pytask_parallel/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def pytask_post_parse(config: dict[str, Any]) -> None:


@hookimpl(tryfirst=True)
def pytask_execute_build(session: Session) -> bool | None:
def pytask_execute_build(session: Session) -> bool | None: # noqa: C901, PLR0915
"""Execute tasks with a parallel backend.

There are three phases while the scheduler has tasks which need to be executed.
Expand All @@ -59,12 +59,10 @@ def pytask_execute_build(session: Session) -> bool | None:
parallel_backend = PARALLEL_BACKENDS[session.config["parallel_backend"]]

with parallel_backend(max_workers=session.config["n_workers"]) as executor:

session.config["_parallel_executor"] = executor
sleeper = _Sleeper()

while session.scheduler.is_active():

try:
newly_collected_reports = []
n_new_tasks = session.config["n_workers"] - len(running_tasks)
Expand Down Expand Up @@ -197,7 +195,7 @@ def pytask_execute_task(session: Session, task: Task) -> Future[Any] | None:
return None


def _unserialize_and_execute_task(
def _unserialize_and_execute_task( # noqa: PLR0913
bytes_function: bytes,
bytes_kwargs: bytes,
show_locals: bool,
Expand Down
4 changes: 2 additions & 2 deletions tests/test_execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ def task_5():

assert session.exit_code == ExitCode.OK
first_task_name = session.execution_reports[0].task.name
assert first_task_name.endswith("task_0") or first_task_name.endswith("task_3")
assert first_task_name.endswith(("task_0", "task_3"))
last_task_name = session.execution_reports[-1].task.name
assert last_task_name.endswith("task_2") or last_task_name.endswith("task_5")
assert last_task_name.endswith(("task_2", "task_5"))


@pytest.mark.end_to_end()
Expand Down