From 19471c8b2449fc248633a19da46f8d3962b00031 Mon Sep 17 00:00:00 2001 From: Bryan Van de Ven Date: Fri, 7 Jan 2022 10:32:31 -0800 Subject: [PATCH 1/2] Handle Bokeh 3.0 CDSView change --- distributed/dashboard/components/scheduler.py | 9 ++++++--- distributed/dashboard/utils.py | 3 +++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/distributed/dashboard/components/scheduler.py b/distributed/dashboard/components/scheduler.py index 86295d06d77..b5926d49696 100644 --- a/distributed/dashboard/components/scheduler.py +++ b/distributed/dashboard/components/scheduler.py @@ -56,7 +56,7 @@ ProfileTimePlot, SystemMonitor, ) -from distributed.dashboard.utils import PROFILING, transpose, update +from distributed.dashboard.utils import BOKEH_VERSION, PROFILING, transpose, update from distributed.diagnostics.graph_layout import GraphLayout from distributed.diagnostics.progress_stream import color_of, progress_quads from distributed.diagnostics.task_stream import TaskStreamPlugin @@ -1944,14 +1944,17 @@ def __init__(self, scheduler, **kwargs): self.edge_source = ColumnDataSource({"x": [], "y": [], "visible": []}) node_view = CDSView( - source=self.node_source, filters=[GroupFilter(column_name="visible", group="True")], ) edge_view = CDSView( - source=self.edge_source, filters=[GroupFilter(column_name="visible", group="True")], ) + # Bokeh >= 3.0 automatically infers the source to use + if BOKEH_VERSION < "3.0": + node_view.source = self.node_source + edge_view.source = self.edge_source + node_colors = factor_cmap( "state", factors=["waiting", "processing", "memory", "released", "erred"], diff --git a/distributed/dashboard/utils.py b/distributed/dashboard/utils.py index ce83f600f3d..6d008eb0450 100644 --- a/distributed/dashboard/utils.py +++ b/distributed/dashboard/utils.py @@ -1,5 +1,7 @@ +from distutils.version import LooseVersion from numbers import Number +import bokeh from bokeh.core.properties import without_property_validation from bokeh.io import curdoc from tlz.curried import first @@ -9,6 +11,7 @@ except ImportError: np = None # type: ignore +BOKEH_VERSION = LooseVersion(bokeh.__version__) PROFILING = False From 748aee345d7976891bf3ec225a9be841007e9d95 Mon Sep 17 00:00:00 2001 From: Bryan Van de Ven Date: Fri, 7 Jan 2022 11:02:40 -0800 Subject: [PATCH 2/2] switch to packaging.version --- distributed/dashboard/components/scheduler.py | 2 +- distributed/dashboard/utils.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/distributed/dashboard/components/scheduler.py b/distributed/dashboard/components/scheduler.py index b5926d49696..8a013fbb5fa 100644 --- a/distributed/dashboard/components/scheduler.py +++ b/distributed/dashboard/components/scheduler.py @@ -1951,7 +1951,7 @@ def __init__(self, scheduler, **kwargs): ) # Bokeh >= 3.0 automatically infers the source to use - if BOKEH_VERSION < "3.0": + if BOKEH_VERSION.major < 3: node_view.source = self.node_source edge_view.source = self.edge_source diff --git a/distributed/dashboard/utils.py b/distributed/dashboard/utils.py index 6d008eb0450..3c077e7a2da 100644 --- a/distributed/dashboard/utils.py +++ b/distributed/dashboard/utils.py @@ -1,9 +1,9 @@ -from distutils.version import LooseVersion from numbers import Number import bokeh from bokeh.core.properties import without_property_validation from bokeh.io import curdoc +from packaging.version import parse as parse_version from tlz.curried import first try: @@ -11,7 +11,7 @@ except ImportError: np = None # type: ignore -BOKEH_VERSION = LooseVersion(bokeh.__version__) +BOKEH_VERSION = parse_version(bokeh.__version__) PROFILING = False