From 99e6359011bca0d4c526b7e46dcc883f36ce0419 Mon Sep 17 00:00:00 2001 From: Doug Davis Date: Tue, 14 Sep 2021 14:12:03 -0400 Subject: [PATCH] use explicit GraphLayout plugin naming. --- distributed/dashboard/components/scheduler.py | 8 +++++++- distributed/dashboard/scheduler.py | 4 +++- distributed/diagnostics/graph_layout.py | 4 +--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/distributed/dashboard/components/scheduler.py b/distributed/dashboard/components/scheduler.py index d8eab514c8c..6b87922edde 100644 --- a/distributed/dashboard/components/scheduler.py +++ b/distributed/dashboard/components/scheduler.py @@ -1938,6 +1938,8 @@ class TaskGraph(DashboardComponent): def __init__(self, scheduler, **kwargs): self.scheduler = scheduler self.layout = GraphLayout(scheduler) + if "graph_layout_name" in kwargs: + self.layout.name = kwargs.pop("graph_layout_name") scheduler.add_plugin(self.layout) self.invisible_count = 0 # number of invisible nodes @@ -3400,7 +3402,11 @@ def tasks_doc(scheduler, extra, doc): def graph_doc(scheduler, extra, doc): with log_errors(): - graph = TaskGraph(scheduler, sizing_mode="stretch_both") + graph = TaskGraph( + scheduler, + sizing_mode="stretch_both", + graph_layout_name="graph-doc-graph-layout", + ) doc.title = "Dask: Task Graph" graph.update() add_periodic_callback(doc, graph, 200) diff --git a/distributed/dashboard/scheduler.py b/distributed/dashboard/scheduler.py index 98791acc9bc..a5b7ad56910 100644 --- a/distributed/dashboard/scheduler.py +++ b/distributed/dashboard/scheduler.py @@ -58,7 +58,9 @@ TaskStream, 100, n_rectangles=1000, clear_interval="10s" ), "/individual-progress": individual_doc(TaskProgress, 100, height=160), - "/individual-graph": individual_doc(TaskGraph, 200), + "/individual-graph": individual_doc( + TaskGraph, 200, graph_layout_name="indiv-graph-layout" + ), "/individual-groups": individual_doc(TaskGroupGraph, 200), "/individual-group-progress": individual_doc(TaskGroupProgress, 200), "/individual-workers-memory": individual_doc(WorkersMemory, 100), diff --git a/distributed/diagnostics/graph_layout.py b/distributed/diagnostics/graph_layout.py index 5e48f939085..3996eba7b47 100644 --- a/distributed/diagnostics/graph_layout.py +++ b/distributed/diagnostics/graph_layout.py @@ -1,5 +1,3 @@ -import uuid - from .plugin import SchedulerPlugin @@ -14,7 +12,7 @@ class GraphLayout(SchedulerPlugin): """ def __init__(self, scheduler): - self.name = f"graph-layout-{uuid.uuid4()}" + self.name = "graph-layout" self.x = {} self.y = {} self.collision = {}