Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 2 additions & 1 deletion distributed/deploy/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,8 @@ async def scale_down(self, workers):
scale_up = scale # backwards compatibility

def __repr__(self):
return "SpecCluster(%r, workers=%d)" % (
return "%s(%r, workers=%d)" % (
type(self).__name__,
self.scheduler_address,
len(self.workers),
)
Expand Down
9 changes: 9 additions & 0 deletions distributed/deploy/tests/test_spec_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@ def test_loop_started():
)


@pytest.mark.asyncio
async def test_repr():
class MyCluster(SpecCluster):
pass

async with MyCluster(..., asynchronous=True) as cluster:
Comment thread
jacobtomlinson marked this conversation as resolved.
Outdated
assert "MyCluster" in str(cluster)


@pytest.mark.asyncio
async def test_scale():
worker = {"cls": Worker, "options": {"nthreads": 1}}
Expand Down