Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TST: Use safer context for ProcessPoolExecutor #8715

Merged
merged 1 commit into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions distributed/tests/test_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
from distributed.metrics import time
from distributed.protocol import pickle
from distributed.scheduler import KilledWorker, Scheduler
from distributed.utils import wait_for
from distributed.utils import get_mp_context, wait_for
from distributed.utils_test import (
NO_AMM,
BlockedExecute,
Expand Down Expand Up @@ -2199,7 +2199,7 @@ async def test_bad_executor_annotation(c, s, a, b):

@gen_cluster(client=True)
async def test_process_executor(c, s, a, b):
with ProcessPoolExecutor() as e:
with ProcessPoolExecutor(mp_context=get_mp_context()) as e:
a.executors["processes"] = e
b.executors["processes"] = e

Expand Down Expand Up @@ -2231,7 +2231,7 @@ def kill_process():

@gen_cluster(nthreads=[("127.0.0.1", 1)], client=True)
async def test_process_executor_kills_process(c, s, a):
with ProcessPoolExecutor() as e:
with ProcessPoolExecutor(mp_context=get_mp_context()) as e:
a.executors["processes"] = e
with dask.annotate(executor="processes", retries=1):
future = c.submit(kill_process)
Expand All @@ -2254,7 +2254,7 @@ def raise_exc():

@gen_cluster(client=True)
async def test_process_executor_raise_exception(c, s, a, b):
with ProcessPoolExecutor() as e:
with ProcessPoolExecutor(mp_context=get_mp_context()) as e:
a.executors["processes"] = e
b.executors["processes"] = e
with dask.annotate(executor="processes", retries=1):
Expand Down
2 changes: 1 addition & 1 deletion distributed/tests/test_worker_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ async def test_custom_executor(c, s, a):
"""Don't try to acquire in-thread metrics when the executor is a ProcessPoolExecutor
or a custom, arbitrary executor.
"""
with ProcessPoolExecutor(1) as e:
with ProcessPoolExecutor(1, mp_context=distributed.utils.get_mp_context()) as e:
# Warm up executor - this can take up to 2s in Windows and MacOSX
e.submit(inc, 1).result()

Expand Down
Loading