diff --git a/distributed/dashboard/components/scheduler.py b/distributed/dashboard/components/scheduler.py index 2934b6e984..a10c68b2d1 100644 --- a/distributed/dashboard/components/scheduler.py +++ b/distributed/dashboard/components/scheduler.py @@ -1942,9 +1942,20 @@ def update(self): if len(self.scheduler.workers) == 0: total_data = None elif name == "memory_percent": - total_data = sum( - ws.metrics["memory"] for ws in self.scheduler.workers.values() - ) / sum(ws.memory_limit for ws in self.scheduler.workers.values()) + total_mem = sum( + ws.memory_limit for ws in self.scheduler.workers.values() + ) + total_data = ( + ( + sum( + ws.metrics["memory"] + for ws in self.scheduler.workers.values() + ) + / total_mem + ) + if total_mem + else "" + ) elif name == "cpu": total_data = ( sum(ws.metrics["cpu"] for ws in self.scheduler.workers.values()) diff --git a/distributed/dashboard/tests/test_scheduler_bokeh.py b/distributed/dashboard/tests/test_scheduler_bokeh.py index 0561cd5fbb..04cadeaf04 100644 --- a/distributed/dashboard/tests/test_scheduler_bokeh.py +++ b/distributed/dashboard/tests/test_scheduler_bokeh.py @@ -430,6 +430,17 @@ def metric(worker): assert s.workers[a.address].metrics["metric"] == -999 +@gen_cluster(client=True, worker_kwargs={"memory_limit": 0}) +async def test_WorkerTable_with_memory_limit_as_0(c, s, a, b): + + wt = WorkerTable(s) + wt.update() + assert all(wt.source.data.values()) + assert wt.source.data["name"][0] == "Total (2)" + assert wt.source.data["memory_limit"][0] == 0 + assert wt.source.data["memory_percent"][0] == "" + + @gen_cluster(client=True) async def test_TaskGraph(c, s, a, b): gp = TaskGraph(s)