Skip to content

Commit

Permalink
Merge pull request #562 from aai-institute/fix/561-future-warning
Browse files Browse the repository at this point in the history
Make default argument for config None and instantiate in init
  • Loading branch information
schroedk authored Apr 17, 2024
2 parents 599f737 + 2bcf3f6 commit f73386d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## Unreleased

### Fixed

- `FutureWarning` for `ParallelConfig` constantly raised without actually
instantiating the object
[PR #562](https://github.com/aai-institute/pyDVL/pull/562)

## 0.9.0 - 🆕 New methods, better docs and bugfixes 📚🐞

### Added
Expand Down
6 changes: 5 additions & 1 deletion src/pydvl/parallel/futures/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
)
def init_executor(
max_workers: Optional[int] = None,
config: ParallelConfig = ParallelConfig(),
config: Optional[ParallelConfig] = None,
**kwargs,
) -> Generator[Executor, None, None]:
"""Initializes a futures executor for the given parallel configuration.
Expand Down Expand Up @@ -50,6 +50,10 @@ def init_executor(
assert results == [1, 2, 3, 4, 5]
```
"""

if config is None:
config = ParallelConfig()

try:
cls = ParallelBackend.BACKENDS[config.backend]
with cls.executor(max_workers=max_workers, config=config, **kwargs) as e:
Expand Down

0 comments on commit f73386d

Please sign in to comment.