Skip to content
Open
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
42 changes: 36 additions & 6 deletions distributed/dashboard/components/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ def __init__(self, worker, height=300, **kwargs):
"duration",
"who",
"y",
"hover",
"transfer",
"keys",
"alpha",
"bandwidth",
"total",
Expand All @@ -135,31 +136,53 @@ def __init__(self, worker, height=300, **kwargs):

fig.rect(
source=self.incoming,
name="Incoming",
x="middle",
y="y",
width="duration",
height=0.9,
color="red",
alpha="alpha",
legend_label="Incoming",
)
fig.rect(
source=self.outgoing,
name="Outgoing",
x="middle",
y="y",
width="duration",
height=0.9,
color="blue",
alpha="alpha",
legend_label="Outgoing",
)

hover = HoverTool(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the hovers now have a different format, which looks like this:

formatted_hover

This are the changes to make it consistent : )

diff --git a/distributed/dashboard/components/worker.py b/distributed/dashboard/components/worker.py
index e3e879c7..1840b3a7 100644
--- a/distributed/dashboard/components/worker.py
+++ b/distributed/dashboard/components/worker.py
@@ -157,12 +157,22 @@ class CommunicatingStream(DashboardComponent):
 
             hover = HoverTool(
                 point_policy="follow_mouse",
-                tooltips=[
-                    ("Transfer", "@transfer"),
-                    ("Keys", "@keys{safe}"),
-                    ("Direction", "$name"),
-                ],
+                tooltips="""
+                <div>
+                    <span style="font-size: 12px; font-weight: bold;">Transfer:</span>&nbsp;
+                    <span style="font-size: 10px; font-family: Monaco, monospace;">@transfer</span>
+                </div>
+                <div>
+                    <span style="font-size: 12px; font-weight: bold;">Keys:</span>&nbsp;
+                    <span style="font-size: 10px; font-family: Monaco, monospace;">@keys{safe}</span>
+                </div>
+                <div>
+                    <span style="font-size: 12px; font-weight: bold;">Direction:</span>&nbsp;
+                    <span style="font-size: 10px; font-family: Monaco, monospace;">$name</span>
+                </div>
+                """,
             )
+
             fig.add_tools(
                 hover,
                 ResetTool(),

point_policy="follow_mouse",
tooltips="""
<div>
<span style="font-size: 12px; font-weight: bold;">Transfer:</span>&nbsp;
<span style="font-size: 10px; font-family: Monaco, monospace;">@transfer</span>
</div>
<div>
<span style="font-size: 12px; font-weight: bold;">Keys:</span>&nbsp;
<span style="font-size: 10px; font-family: Monaco, monospace;">@keys{safe}</span>
</div>
<div>
<span style="font-size: 12px; font-weight: bold;">Direction:</span>&nbsp;
<span style="font-size: 10px; font-family: Monaco, monospace;">$name</span>
</div>
""",
)

hover = HoverTool(point_policy="follow_mouse", tooltips="""@hover""")
fig.add_tools(
hover,
ResetTool(),
PanTool(dimensions="width"),
WheelZoomTool(dimensions="width"),
)

fig.legend.location = "top_left"
self.root = fig

self.last_incoming = 0
Expand Down Expand Up @@ -187,7 +210,6 @@ def update(self):
for msg in msgs:
if "compressed" in msg:
del msg["compressed"]
del msg["keys"]

bandwidth = msg["total"] / (msg["duration"] or 0.5)
bw = max(min(bandwidth / 500e6, 1), 0.3)
Expand All @@ -198,11 +220,14 @@ def update(self):
self.who[msg["who"]] = len(self.who)
msg["y"] = self.who[msg["who"]]

msg["hover"] = "{} / {} = {}/s".format(
msg["transfer"] = "{} / {} = {}/s".format(
format_bytes(msg["total"]),
format_time(msg["duration"]),
format_bytes(msg["total"] / msg["duration"]),
)
msg["keys"] = "<br>".join(
f"{k}: {format_bytes(v)}" for k, v in msg["keys"].items()
)

for k in ["middle", "duration", "start", "stop"]:
msg[k] = msg[k] * 1000
Expand Down Expand Up @@ -234,9 +259,14 @@ def __init__(self, worker, **kwargs):
x_range=x_range,
**kwargs,
)
fig.line(source=self.source, x="x", y="in", color="red")
fig.line(source=self.source, x="x", y="out", color="blue")
fig.line(
source=self.source, x="x", y="in", color="red", legend_label="Incoming"
)
fig.line(
source=self.source, x="x", y="out", color="blue", legend_label="Outgoing"
)

fig.legend.location = "top_left"
fig.add_tools(
ResetTool(), PanTool(dimensions="width"), WheelZoomTool(dimensions="width")
)
Expand Down