From a29aa6dc1aec816bc50fa29482fc6180875630fe Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Tue, 23 Dec 2025 09:53:30 +0100 Subject: [PATCH 1/3] Feature: Add built-in network test --- src/executorlib/executor/single.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/executorlib/executor/single.py b/src/executorlib/executor/single.py index 2f75d0c0..db9f1170 100644 --- a/src/executorlib/executor/single.py +++ b/src/executorlib/executor/single.py @@ -1,3 +1,4 @@ +from time import sleep from typing import Callable, Optional, Union from executorlib.executor.base import BaseExecutor @@ -188,6 +189,7 @@ def __init__( log_obj_size=log_obj_size, ) ) + _executor_self_test(exe=self._task_scheduler) class TestClusterExecutor(BaseExecutor): @@ -446,3 +448,15 @@ def create_single_node_executor( executor_kwargs=resource_dict, spawner=MpiExecSpawner, ) + + +def _executor_self_test(exe): + f = exe.submit(sum, [1, 1]) + counter = 0 + while not f.done() and counter < 10: + sleep(0.1) + counter += 1 + if not f.done(): + exe.shutdown(wait=False, cancel_futures=False) + raise TimeoutError("Plase try \"hostname_localhost=True\" in the initialization of the SingleNodeExecutor(hostname_localhost=True).") + return True From 4f1dc533d875ed240dc73c2254676a1f096c7fe5 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 23 Dec 2025 08:54:04 +0000 Subject: [PATCH 2/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/executorlib/executor/single.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/executorlib/executor/single.py b/src/executorlib/executor/single.py index db9f1170..1cbcf1f9 100644 --- a/src/executorlib/executor/single.py +++ b/src/executorlib/executor/single.py @@ -458,5 +458,7 @@ def _executor_self_test(exe): counter += 1 if not f.done(): exe.shutdown(wait=False, cancel_futures=False) - raise TimeoutError("Plase try \"hostname_localhost=True\" in the initialization of the SingleNodeExecutor(hostname_localhost=True).") + raise TimeoutError( + 'Plase try "hostname_localhost=True" in the initialization of the SingleNodeExecutor(hostname_localhost=True).' + ) return True From 11ad8e37dfa04ac05bf63c06116e7dc4b8ab47b0 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Tue, 23 Dec 2025 10:00:30 +0100 Subject: [PATCH 3/3] reset after successful selftest --- src/executorlib/executor/single.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/executorlib/executor/single.py b/src/executorlib/executor/single.py index 1cbcf1f9..96125698 100644 --- a/src/executorlib/executor/single.py +++ b/src/executorlib/executor/single.py @@ -461,4 +461,7 @@ def _executor_self_test(exe): raise TimeoutError( 'Plase try "hostname_localhost=True" in the initialization of the SingleNodeExecutor(hostname_localhost=True).' ) + else: + exe._future_hash_dict = {} + exe._task_hash_dict = {} return True