From ed6efda8ad6a0a07577550375543b79d183f2e5a Mon Sep 17 00:00:00 2001 From: liamhuber Date: Mon, 2 Mar 2026 09:07:27 -0800 Subject: [PATCH 1/2] Monkey-patch https://github.com/pyiron/executorlib/pull/943 Signed-off-by: liamhuber --- pyiron_workflow/executors/wrapped_executorlib.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pyiron_workflow/executors/wrapped_executorlib.py b/pyiron_workflow/executors/wrapped_executorlib.py index c8775df30..1740a3344 100644 --- a/pyiron_workflow/executors/wrapped_executorlib.py +++ b/pyiron_workflow/executors/wrapped_executorlib.py @@ -1,4 +1,5 @@ import inspect +from threading import Thread from typing import Any, ClassVar from executorlib import BaseExecutor, SingleNodeExecutor, SlurmClusterExecutor @@ -22,6 +23,18 @@ class ProtectedResourceError(ValueError): class CacheOverride(BaseExecutor): override_cache_file_name: ClassVar[str] = "executorlib_cache" + def shutdown(self, wait: bool = True, *, cancel_futures: bool = False): + if ( + self._process is not None + and self._future_queue is not None + and wait + and isinstance(self._process, Thread) + ): + self._process.join() + self._future_queue.join() + else: + super().shutdown(wait, cancel_futures=cancel_futures) + def submit(self, fn, /, *args, **kwargs): """ We demand that `fn` be the bound-method `on_run` of a `Lexical`+`Runnable` From d08960fd926807856b87e33dbd9146c6e8d89a1b Mon Sep 17 00:00:00 2001 From: liamhuber Date: Mon, 2 Mar 2026 09:14:47 -0800 Subject: [PATCH 2/2] Include extra step logic Signed-off-by: liamhuber --- pyiron_workflow/executors/wrapped_executorlib.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyiron_workflow/executors/wrapped_executorlib.py b/pyiron_workflow/executors/wrapped_executorlib.py index 1740a3344..8289e94f8 100644 --- a/pyiron_workflow/executors/wrapped_executorlib.py +++ b/pyiron_workflow/executors/wrapped_executorlib.py @@ -30,6 +30,9 @@ def shutdown(self, wait: bool = True, *, cancel_futures: bool = False): and wait and isinstance(self._process, Thread) ): + self._future_queue.put( + {"shutdown": True, "wait": wait, "cancel_futures": cancel_futures} + ) self._process.join() self._future_queue.join() else: