From 20af55c80caadec6d75dc80044d6ea357eecc399 Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Mon, 30 Sep 2024 17:44:46 +0200 Subject: [PATCH 1/2] Fix reset_global_job_kwargs --- src/spikeinterface/core/globals.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/spikeinterface/core/globals.py b/src/spikeinterface/core/globals.py index 23d60a5ac5..ace71128b9 100644 --- a/src/spikeinterface/core/globals.py +++ b/src/spikeinterface/core/globals.py @@ -135,7 +135,9 @@ def reset_global_job_kwargs(): Reset the global job kwargs. """ global global_job_kwargs - global_job_kwargs = dict(n_jobs=1, chunk_duration="1s", progress_bar=True) + global_job_kwargs = dict( + n_jobs=1, chunk_duration="1s", progress_bar=True, mp_context=None, max_threads_per_process=1 + ) def is_set_global_job_kwargs_set() -> bool: From 66a3ea456be5572f6c2e96ad1d59e2fadad409ac Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Tue, 1 Oct 2024 10:17:28 +0200 Subject: [PATCH 2/2] Add _default_job_kwargs --- src/spikeinterface/core/globals.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/spikeinterface/core/globals.py b/src/spikeinterface/core/globals.py index ace71128b9..38f39c5481 100644 --- a/src/spikeinterface/core/globals.py +++ b/src/spikeinterface/core/globals.py @@ -97,8 +97,10 @@ def is_set_global_dataset_folder() -> bool: ######################################## +_default_job_kwargs = dict(n_jobs=1, chunk_duration="1s", progress_bar=True, mp_context=None, max_threads_per_process=1) + global global_job_kwargs -global_job_kwargs = dict(n_jobs=1, chunk_duration="1s", progress_bar=True, mp_context=None, max_threads_per_process=1) +global_job_kwargs = _default_job_kwargs.copy() global global_job_kwargs_set global_job_kwargs_set = False @@ -135,9 +137,7 @@ def reset_global_job_kwargs(): Reset the global job kwargs. """ global global_job_kwargs - global_job_kwargs = dict( - n_jobs=1, chunk_duration="1s", progress_bar=True, mp_context=None, max_threads_per_process=1 - ) + global_job_kwargs = _default_job_kwargs.copy() def is_set_global_job_kwargs_set() -> bool: