- bugfix: do not restart pool when n_processes = None
This commit is contained in:
@@ -375,7 +375,8 @@ class PoolSingleton:
|
|||||||
def __new__(cls, n_processes: int = None, *args: Any, **kwargs: Any) -> 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
|
# 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 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()
|
cls.instance.close()
|
||||||
if cls.instance is None or not cls.instance.is_alive:
|
if cls.instance is None or not cls.instance.is_alive:
|
||||||
new = super().__new__(cls)
|
new = super().__new__(cls)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "parfor"
|
name = "parfor"
|
||||||
version = "2024.5.0"
|
version = "2024.5.1"
|
||||||
description = "A package to mimic the use of parfor as done in Matlab."
|
description = "A package to mimic the use of parfor as done in Matlab."
|
||||||
authors = ["Wim Pomp <wimpomp@gmail.com>"]
|
authors = ["Wim Pomp <wimpomp@gmail.com>"]
|
||||||
license = "GPLv3"
|
license = "GPLv3"
|
||||||
|
|||||||
Reference in New Issue
Block a user