Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions pyiron_workflow/executors/wrapped_executorlib.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import inspect
from threading import Thread
from typing import Any, ClassVar

from executorlib import BaseExecutor, SingleNodeExecutor, SlurmClusterExecutor
Expand All @@ -22,6 +23,21 @@ 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._future_queue.put(
{"shutdown": True, "wait": wait, "cancel_futures": cancel_futures}
)
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`
Expand Down
Loading