Use random port in test_dask_spec.py::test_text
+import random
import sys
+import pytest
import yaml
from distributed import Client
from distributed.utils_test import gen_cluster, gen_test, popen
+@pytest.mark.flaky(reruns=2)
@gen_test(timeout=120)
async def test_text():
+ port = random.randint(10000, 50000)
with popen(
[
sys.executable,
"-m",
"distributed.cli.dask_spec",
"--spec",
- '{"cls": "dask.distributed.Scheduler", "opts": {"port": 9373}}',
+ '{"cls": "dask.distributed.Scheduler", "opts": {"port": %d}}' % port,
]
):
with popen(
@@ -22,12 +26,12 @@ async def test_text():
sys.executable,
"-m",
"distributed.cli.dask_spec",
- "tcp://localhost:9373",
+ "tcp://localhost:%d" % port,
"--spec",
'{"cls": "dask.distributed.Worker", "opts": {"nanny": false, "nthreads": 3, "name": "foo"}}',
]
):
- async with Client("tcp://localhost:9373", asynchronous=True) as client:
+ async with Client("tcp://localhost:%d" % port, asynchronous=True) as client:
await client.wait_for_workers(1)
info = await client.scheduler.identity()
[w] = info["workers"].values()
