Skip to content
Closed
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
7 changes: 6 additions & 1 deletion distributed/deploy/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def __init__(
start=None,
host=None,
ip=None,
scheduler_port=0,
scheduler_port=None,
silence_logs=logging.WARN,
dashboard_address=":8787",
worker_dashboard_address=None,
Expand Down Expand Up @@ -169,6 +169,11 @@ def __init__(
if not protocol.endswith("://"):
protocol = protocol + "://"

if protocol.startswith("tcp"):
scheduler_port = 8786
else:
scheduler_port = 0

if host is None and not protocol.startswith("inproc") and not interface:
host = "127.0.0.1"

Expand Down
9 changes: 9 additions & 0 deletions distributed/deploy/tests/test_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

from dask.system import CPU_COUNT
from distributed import Client, Worker, Nanny, get_client
from distributed.comm.addressing import parse_host_port
from distributed.core import Status
from distributed.deploy.local import LocalCluster
from distributed.metrics import time
Expand Down Expand Up @@ -1049,6 +1050,14 @@ async def test_no_workers(cleanup):
pass


@pytest.mark.asyncio
async def test_default_scheduler_port():
async with LocalCluster(n_workers=2, processes=False, asynchronous=True) as cluster:

_, port = parse_host_port(cluster.scheduler_address)
assert port == 8786


@pytest.mark.asyncio
async def test_cluster_names():
async with LocalCluster(processes=False, asynchronous=True) as unnamed_cluster:
Expand Down