Skip to content

Commit 163c4d0

Browse files
authored
Merge pull request #470 from simvue-io/hotfix/fix-wrong-windows-warning
Fix incorrect warning for Windows users
2 parents 2327069 + 567c731 commit 163c4d0

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

.github/workflows/test_client_windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ jobs:
2727
export SIMVUE_TOKEN=${{ secrets.SIMVUE_TOKEN }}
2828
poetry install --all-extras
2929
poetry run python -m pip install torch
30-
poetry run pytest tests/unit/ tests/refactor/ -m 'not scenario'
30+
poetry run pytest tests/unit/ tests/refactor/ -m 'not scenario' -m 'not unix'

simvue/executor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,9 @@ def callback_function(status_code: int, std_out: str, std_err: str) -> None:
196196
if not self._runner.name:
197197
raise RuntimeError("Cannot add process, expected Run instance to have name")
198198

199-
if sys.platform == "win32" and completion_callback:
199+
if sys.platform == "win32" and completion_trigger:
200200
logger.warning(
201-
"Completion callback for 'add_process' may fail on Windows due to "
201+
"Completion trigger for 'add_process' may fail on Windows "
202202
"due to function pickling restrictions"
203203
)
204204

simvue/run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ def callback_function(status_code: int, std_out: str, std_err: str) -> None:
720720
"""
721721
if platform.system() == "Windows" and completion_trigger:
722722
raise RuntimeError(
723-
"Use of 'completion_callback' on Windows based operating systems is unsupported "
723+
"Use of 'completion_trigger' on Windows based operating systems is unsupported "
724724
"due to function pickling restrictions for multiprocessing"
725725
)
726726

tests/refactor/test_executor.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@ def test_executor_add_process(
1717
request: pytest.FixtureRequest
1818
) -> None:
1919
import logging
20+
trigger = multiprocessing.Event()
21+
22+
def completion_callback(*_, trigger=trigger, **__):
23+
trigger.set()
2024
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
2125
run = simvue.Run()
22-
completion_trigger = multiprocessing.Event()
2326
run.init(
2427
f"test_executor_{'success' if successful else 'fail'}",
2528
tags=["simvue_client_unit_tests", request.node.name.replace("[", "_").replace("]", "_")],
@@ -29,10 +32,10 @@ def test_executor_add_process(
2932
identifier=f"test_add_process_{'success' if successful else 'fail'}",
3033
c=f"exit {0 if successful else 1}",
3134
executable="bash" if sys.platform != "win32" else "powershell",
32-
completion_trigger=completion_trigger
35+
completion_callback=completion_callback
3336
)
3437

35-
while not completion_trigger.is_set():
38+
while not trigger.is_set():
3639
time.sleep(1)
3740

3841
if successful:
@@ -43,6 +46,7 @@ def test_executor_add_process(
4346

4447

4548
@pytest.mark.executor
49+
@pytest.mark.unix
4650
def test_executor_multiprocess(request: pytest.FixtureRequest) -> None:
4751
triggers: dict[int, multiprocessing.synchronize.Event] = {}
4852
callbacks: dict[int, typing.Callable] = {}
@@ -149,6 +153,7 @@ def completion_callback(*_, success: dict[str, bool]=success, **__):
149153
assert success["complete"]
150154

151155
@pytest.mark.executor
156+
@pytest.mark.unix
152157
def test_completion_trigger_set(request: pytest.FixtureRequest) -> None:
153158
trigger = multiprocessing.Event()
154159

0 commit comments

Comments
 (0)