diff --git a/distributed/deploy/spec.py b/distributed/deploy/spec.py index 1052b5a1f1d..99ad49cfc22 100644 --- a/distributed/deploy/spec.py +++ b/distributed/deploy/spec.py @@ -97,7 +97,53 @@ async def finished(self): await self._event_finished.wait() def __repr__(self): - return f"<{type(self).__name__}: status={self.status}>" + return f"<{dask.utils.typename(type(self))}: status={self.status.name}>" + + def _repr_html_(self): + if self.status == Status.created: + status = "Created" + bg_color = "#caf0f8" + border_color = "#48cae4" + elif self.status == Status.running: + status = "Running" + bg_color = "#c7f9cc" + border_color = "#78c6a3" + elif self.status == Status.closed: + status = "Closed" + bg_color = "#ffbfad" + border_color = "#ff6132" + + html = f""" +
+
+
+

{dask.utils.typename(type(self))}

+

Status: {status}

+
+

+ + + + + + + + + +
Address{self.address}
External Address{self.external_address}

+
+ + """ + + return html async def __aenter__(self): await self diff --git a/distributed/deploy/ssh.py b/distributed/deploy/ssh.py index 492c4ce05ef..81e08e72399 100644 --- a/distributed/deploy/ssh.py +++ b/distributed/deploy/ssh.py @@ -42,9 +42,6 @@ async def close(self): self.connection.close() await super().close() - def __repr__(self): - return f"" - class Worker(Process): """A Remote Dask Worker controled by SSH