diff --git a/distributed/dashboard/components/scheduler.py b/distributed/dashboard/components/scheduler.py index 31224d5c12..506cec3c37 100644 --- a/distributed/dashboard/components/scheduler.py +++ b/distributed/dashboard/components/scheduler.py @@ -3343,7 +3343,7 @@ def update(self): for tp in self.scheduler.task_prefixes.values(): states = tp.states - if any(states.get(s) for s in state.keys()): + if any(v for k, v in states.items() if k != "forgotten"): state["memory"][tp.name] = states["memory"] state["erred"][tp.name] = states["erred"] state["released"][tp.name] = states["released"] diff --git a/distributed/dashboard/tests/test_scheduler_bokeh.py b/distributed/dashboard/tests/test_scheduler_bokeh.py index e4ee7f1505..caeadeab69 100644 --- a/distributed/dashboard/tests/test_scheduler_bokeh.py +++ b/distributed/dashboard/tests/test_scheduler_bokeh.py @@ -287,6 +287,30 @@ async def test_TaskProgress_empty(c, s, a, b): assert not any(len(v) for v in tp.source.data.values()) +@gen_cluster(client=True) +async def test_TaskProgress_no_worker(c, s, a, b): + """The no-worker state has special treatment as dashes cause issues in Bokeh""" + tp = TaskProgress(s) + + future = c.submit(slowinc, 0, resources={"foo": 1}) + while not s.tasks: + await asyncio.sleep(0.01) + + tp.update() + assert tp.source.data["all"] == [1] + assert tp.source.data["no_worker"] == [1] + assert tp.source.data["name"] == ["slowinc"] + + del future + while s.tasks: + await asyncio.sleep(0.01) + + tp.update() + assert tp.source.data["all"] == [] + assert tp.source.data["no_worker"] == [] + assert tp.source.data["name"] == [] + + @gen_cluster(client=True) async def test_CurrentLoad(c, s, a, b): cl = CurrentLoad(s)