From 7bb979f706202314dea2a1d32697876a06e8033b Mon Sep 17 00:00:00 2001 From: Matt Date: Wed, 3 Jun 2026 11:17:08 +0100 Subject: [PATCH 1/2] Remove completion trigger windows restriction --- simvue/executor.py | 7 ------- simvue/run.py | 7 ------- tests/functional/test_executor.py | 4 +--- 3 files changed, 1 insertion(+), 17 deletions(-) diff --git a/simvue/executor.py b/simvue/executor.py index ff8be2fc..da9c98ac 100644 --- a/simvue/executor.py +++ b/simvue/executor.py @@ -10,7 +10,6 @@ import logging import multiprocessing.synchronize -import sys import threading import os import shutil @@ -237,12 +236,6 @@ def callback_function(status_code: int, std_out: str, std_err: str) -> None: if not self._runner.name: raise RuntimeError("Cannot add process, expected Run instance to have name") - if sys.platform == "win32" and completion_trigger: - logger.warning( - "Completion trigger for 'add_process' may fail on Windows " - "due to function pickling restrictions" - ) - # To check the executable provided by the user exists combine with environment # PATH variable if exists, if not provided use the current environment _session_path: str | None = (os.environ.copy() | (env or {})).get("PATH", None) diff --git a/simvue/run.py b/simvue/run.py index ca17edb7..14525809 100644 --- a/simvue/run.py +++ b/simvue/run.py @@ -25,7 +25,6 @@ import time import types import functools -import platform import typing import uuid import numpy @@ -941,12 +940,6 @@ def callback_function(status_code: int, std_out: str, std_err: str) -> None: ... + "use an instance of 'threading.Event' instead." ) - if platform.system() == "Windows" and completion_trigger: - raise RuntimeError( - "Use of 'completion_trigger' on Windows based operating systems is unsupported " - "due to function pickling restrictions for multiprocessing" - ) - if isinstance(executable, pathlib.Path) and not executable.is_file(): raise FileNotFoundError(f"Executable '{executable}' is not a valid file") diff --git a/tests/functional/test_executor.py b/tests/functional/test_executor.py index 375dfe98..2453f34e 100644 --- a/tests/functional/test_executor.py +++ b/tests/functional/test_executor.py @@ -58,9 +58,8 @@ def completion_callback(*_, trigger=trigger, **__): @pytest.mark.executor -@pytest.mark.unix def test_executor_multiprocess(request: pytest.FixtureRequest) -> None: - triggers: dict[int, multiprocessing.synchronize.Event] = {} + triggers: dict[int, threading.Event] = {} callbacks: dict[int, typing.Callable] = {} events: dict[int, bool] = {} folder_id = f"{uuid.uuid4()}".split("-")[0] @@ -180,7 +179,6 @@ def completion_callback(*_, success: dict[str, bool]=success, **__): folder.delete(recursive=True, delete_runs=True) @pytest.mark.executor -@pytest.mark.unix def test_completion_trigger_set(request: pytest.FixtureRequest) -> None: trigger = threading.Event() folder_id = f"{uuid.uuid4()}".split("-")[0] From 0c98c8f365e0bdc8d13e42c71241a0dc5237e38c Mon Sep 17 00:00:00 2001 From: Matt Date: Wed, 3 Jun 2026 14:52:55 +0100 Subject: [PATCH 2/2] Correct docstrings --- simvue/executor.py | 4 +--- simvue/run.py | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/simvue/executor.py b/simvue/executor.py index da9c98ac..979d1b48 100644 --- a/simvue/executor.py +++ b/simvue/executor.py @@ -207,8 +207,6 @@ def callback_function(status_code: int, std_out: str, std_err: str) -> None: ... ``` - Note `completion_trigger` is not supported on Windows operating systems. - Parameters ---------- identifier : str @@ -229,7 +227,7 @@ def callback_function(status_code: int, std_out: str, std_err: str) -> None: completion_callback : typing.Callable | None, optional callback to run when process terminates completion_trigger : threading.Event | None, optional - this trigger event is set when the processes completes (not supported on Windows) + this trigger event is set when the processes completes """ pos_args = list(args) diff --git a/simvue/run.py b/simvue/run.py index 14525809..36fa9384 100644 --- a/simvue/run.py +++ b/simvue/run.py @@ -875,8 +875,6 @@ def add_process( def callback_function(status_code: int, std_out: str, std_err: str) -> None: ... ``` - Note `completion_callback` is not supported on Windows operating systems. - Alternatively you can use `completion_trigger` to create a multiprocessing event which will be set when the process has completed. @@ -896,7 +894,7 @@ def callback_function(status_code: int, std_out: str, std_err: str) -> None: ... the input file to run, note this only work if the input file is not an option, if this is the case you should provide it as such and perform the upload manually, by default None completion_callback : typing.Callable | None, optional - callback to run when process terminates (not supported on Windows) + callback to run when process terminates completion_trigger : threading.Event | None, optional this trigger event is set when the processes completes env : dict[str, str], optional