Skip to content
This repository was archived by the owner on Jul 25, 2023. It is now read-only.

Commit d357956

Browse files
Explicitly set multiprocessing to use spawn not fork.
Enable all db and flow tests. On linux, multiprocessing's default is fork, which causes gRPC to fail because its default polling mechanism is epoll. See grpc/grpc#23796
1 parent 307c7eb commit d357956

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

.github/workflows/check and test.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,4 @@ jobs:
5959
PYTHONDEVMODE: 1 # see https://docs.python.org/3/library/devmode.html#devmode
6060
GRPC_VERBOSITY: debug
6161
run: |
62-
poetry run pytest tests/test_meadowdb tests/test_meadowflow/test_event_log.py tests/test_meadowflow/test_time_events.py
63-
62+
poetry run pytest tests/test_meadowdb tests/test_meadowflow

src/meadowflow/local_job_runner.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
TODO capabilities
33
TODO checking for and restarting requested but not running jobs
44
"""
5+
import multiprocessing
56
import traceback
67
from concurrent.futures.process import BrokenProcessPool
78
from typing import Dict, Iterable, Callable, Any, Tuple, Sequence, Optional
@@ -41,7 +42,8 @@ class LocalJobRunner(JobRunner):
4142

4243
def __init__(self, event_log: EventLog):
4344
self._running: Dict[str, Future] = {}
44-
self._executor = ProcessPoolExecutor(max_workers=5)
45+
ctx = multiprocessing.get_context("spawn")
46+
self._executor = ProcessPoolExecutor(max_workers=5, mp_context=ctx)
4547
self._event_log = event_log
4648

4749
async def run(

src/meadowflow/server/server_main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ def main_in_child_process(
3838
logs, etc. If there's an existing server already running, the child process will
3939
just die immediately without doing anything.
4040
"""
41-
server_process = multiprocessing.Process(
41+
ctx = multiprocessing.get_context("spawn")
42+
server_process = ctx.Process(
4243
target=main, args=(host, port, job_runner_poll_delay_seconds)
4344
)
4445
server_process.start()

src/meadowgrid/coordinator_main.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,8 @@ def main_in_child_process(
4141
it, see logs, etc. If there's an existing server already running, the child process
4242
will just die immediately without doing anything.
4343
"""
44-
server_process = multiprocessing.Process(
45-
target=main, args=(host, port, meadowflow_address)
46-
)
44+
ctx = multiprocessing.get_context("spawn")
45+
server_process = ctx.Process(target=main, args=(host, port, meadowflow_address))
4746
server_process.start()
4847

4948
try:

src/meadowgrid/job_worker_main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ def main_in_child_process(
5757
see logs, etc. If there's an existing worker already running, the child process will
5858
just die immediately without doing anything.
5959
"""
60-
server_process = multiprocessing.Process(
60+
ctx = multiprocessing.get_context("spawn")
61+
server_process = ctx.Process(
6162
target=main,
6263
args=(working_folder, available_resources, coordinator_host, coordinator_port),
6364
)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy