Skip to content

Commit

Permalink
Attempt to fix test_preload_remote_module on windows (#3775)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbourbeau authored May 6, 2020
1 parent d0f6aec commit 3e47fa0
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions distributed/cli/tests/test_dask_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,25 +300,33 @@ def check_scheduler():
shutil.rmtree(tmpdir)


def test_preload_remote_module(loop, tmpdir):
with open(tmpdir / "scheduler_info.py", "w") as f:
def test_preload_remote_module(loop, tmp_path):
with open(tmp_path / "scheduler_info.py", "w") as f:
f.write(PRELOAD_TEXT)

with popen(["python", "-m", "http.server", "9382"], cwd=tmpdir):
with popen([sys.executable, "-m", "http.server", "9382"], cwd=tmp_path):
with popen(
[
"dask-scheduler",
"--scheduler-file",
tmpdir / "scheduler-file.json",
str(tmp_path / "scheduler-file.json"),
"--preload",
"http://localhost:9382/scheduler_info.py",
],
) as proc:
with Client(scheduler_file=tmpdir / "scheduler-file.json", loop=loop) as c:
assert (
c.run_on_scheduler(lambda dask_scheduler: dask_scheduler.foo)
== "bar"
)
with Client(
scheduler_file=tmp_path / "scheduler-file.json", loop=loop
) as c:
for i in range(10):
val = c.run_on_scheduler(
lambda dask_scheduler: getattr(dask_scheduler, "foo", None)
)
if val == "bar":
break
else:
sleep(0.1)
else:
raise ValueError(val)


PRELOAD_COMMAND_TEXT = """
Expand Down

0 comments on commit 3e47fa0

Please sign in to comment.