Skip to content

Commit 805a771

Browse files
committed
Extract changes.
1 parent d082e28 commit 805a771

File tree

4 files changed

+5
-10
lines changed

4 files changed

+5
-10
lines changed

docs/source/changes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ releases are available on [PyPI](https://pypi.org/project/pytask-parallel) and
1414
- {pull}`92` redirects stdout and stderr from processes and loky and shows them in error
1515
reports.
1616
- {pull}`93` adds documentation on readthedocs.
17+
- {pull}`94` implements `ParallelBackend.NONE` as the default backend.
1718

1819
## 0.4.1 - 2024-01-12
1920

src/pytask_parallel/backends.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,6 @@ def _get_thread_pool_executor(n_workers: int) -> Executor:
8484
class ParallelBackend(Enum):
8585
"""Choices for parallel backends."""
8686

87-
NONE = "none"
88-
8987
CUSTOM = "custom"
9088
DASK = "dask"
9189
LOKY = "loky"

src/pytask_parallel/build.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def pytask_extend_command_line_interface(cli: click.Group) -> None:
2626
["--parallel-backend"],
2727
type=EnumChoice(ParallelBackend),
2828
help="Backend for the parallelization.",
29-
default=ParallelBackend.NONE,
29+
default=ParallelBackend.LOKY,
3030
),
3131
]
3232
cli.commands["build"].params.extend(additional_parameters)

src/pytask_parallel/config.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ def pytask_parse_config(config: dict[str, Any]) -> None:
2121
"""Parse the configuration."""
2222
__tracebackhide__ = True
2323

24+
if config["n_workers"] == "auto":
25+
config["n_workers"] = max(os.cpu_count() - 1, 1)
26+
2427
try:
2528
config["parallel_backend"] = ParallelBackend(config["parallel_backend"])
2629
except ValueError:
@@ -30,13 +33,6 @@ def pytask_parse_config(config: dict[str, Any]) -> None:
3033
)
3134
raise ValueError(msg) from None
3235

33-
if config["n_workers"] == "auto":
34-
config["n_workers"] = max(os.cpu_count() - 1, 1)
35-
36-
# If more than one worker is used, and no backend is set, use loky.
37-
if config["n_workers"] > 1 and config["parallel_backend"] == ParallelBackend.NONE:
38-
config["parallel_backend"] = ParallelBackend.LOKY
39-
4036
config["delay"] = 0.1
4137

4238

0 commit comments

Comments
 (0)