From 7e67afa6be6ba1911947355b5954c3101b99062e Mon Sep 17 00:00:00 2001 From: Gianluca Ficarelli <26835404+GianlucaFicarelli@users.noreply.github.com> Date: Fri, 3 May 2024 13:00:13 +0200 Subject: [PATCH] Do not call shutdown() in run_parallel() when jobs=1 (#13) --- CHANGELOG.rst | 8 ++++++++ src/blueetl_core/parallel.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index eee3150..71f4c9b 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,14 @@ Changelog ========= +Version 0.2.4 +------------- + +Bug fixes +~~~~~~~~~ + +- Do not call ``get_reusable_executor().shutdown()`` when tasks are run serially in ``run_parallel()``. + Version 0.2.3 ------------- diff --git a/src/blueetl_core/parallel.py b/src/blueetl_core/parallel.py index 0d974d0..9232bef 100644 --- a/src/blueetl_core/parallel.py +++ b/src/blueetl_core/parallel.py @@ -117,7 +117,7 @@ def run_parallel( for i, task in enumerate(tasks) ) finally: - if shutdown_executor and (not backend or backend == "loky"): + if shutdown_executor and (not backend or backend == "loky") and jobs != 1: # shutdown the pool of processes used by loky get_reusable_executor().shutdown(wait=True)