- bugfix: do not restart pool when n_processes = None

This commit is contained in:
Wim Pomp
2024-05-28 16:35:14 +02:00
parent 9783c1d1f2
commit b609df8b52
2 changed files with 3 additions and 2 deletions

View File

@@ -375,7 +375,8 @@ class PoolSingleton:
def __new__(cls, n_processes: int = None, *args: Any, **kwargs: Any) -> PoolSingleton:
# restart if any workers have shut down or if we want to have a different number of processes
if cls.instance is not None:
if cls.instance.n_workers.value < cls.instance.n_processes or cls.instance.n_processes != n_processes:
if (cls.instance.n_workers.value < cls.instance.n_processes or
cls.instance.n_processes != (n_processes or cpu_count)):
cls.instance.close()
if cls.instance is None or not cls.instance.is_alive:
new = super().__new__(cls)

View File

@@ -1,6 +1,6 @@
[tool.poetry]
name = "parfor"
version = "2024.5.0"
version = "2024.5.1"
description = "A package to mimic the use of parfor as done in Matlab."
authors = ["Wim Pomp <wimpomp@gmail.com>"]
license = "GPLv3"