diff --git a/distributed/dashboard/components/worker.py b/distributed/dashboard/components/worker.py index 7263d2b6fa2..885f0a1bdbd 100644 --- a/distributed/dashboard/components/worker.py +++ b/distributed/dashboard/components/worker.py @@ -111,7 +111,8 @@ def __init__(self, worker, height=300, **kwargs): "duration", "who", "y", - "hover", + "transfer", + "keys", "alpha", "bandwidth", "total", @@ -135,24 +136,45 @@ 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( + point_policy="follow_mouse", + tooltips=""" +
+ Transfer:  + @transfer +
+
+ Keys:  + @keys{safe} +
+
+ Direction:  + $name +
+ """, ) - hover = HoverTool(point_policy="follow_mouse", tooltips="""@hover""") fig.add_tools( hover, ResetTool(), @@ -160,6 +182,7 @@ def __init__(self, worker, height=300, **kwargs): WheelZoomTool(dimensions="width"), ) + fig.legend.location = "top_left" self.root = fig self.last_incoming = 0 @@ -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) @@ -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"] = "
".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 @@ -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") )