From 6c69e8808c7171f4540ff2614ef03aaebe2a9ec9 Mon Sep 17 00:00:00 2001 From: Bas Nijholt Date: Wed, 30 Nov 2022 13:30:42 -0800 Subject: [PATCH] Use default executor when Runner(..., executor=None) (#389) --- adaptive/runner.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/adaptive/runner.py b/adaptive/runner.py index c5543ac7c..ff3a137c3 100644 --- a/adaptive/runner.py +++ b/adaptive/runner.py @@ -182,7 +182,7 @@ def __init__( npoints_goal: int | None = None, end_time_goal: datetime | None = None, duration_goal: timedelta | int | float | None = None, - executor: (ExecutorTypes | None) = None, + executor: ExecutorTypes | None = None, ntasks: int = None, log: bool = False, shutdown_executor: bool = False, @@ -934,11 +934,9 @@ def replay_log( # -- Internal executor-related, things -def _ensure_executor( - executor: ExecutorTypes | None, -) -> concurrent.Executor: +def _ensure_executor(executor: ExecutorTypes | None) -> concurrent.Executor: if executor is None: - executor = concurrent.ProcessPoolExecutor() + executor = _default_executor() if isinstance(executor, concurrent.Executor): return executor