From f591f6c1c8fa14af6df2adfdcf3255c59dff12b1 Mon Sep 17 00:00:00 2001 From: Max Fitton Date: Sat, 12 Dec 2020 23:34:24 -0800 Subject: [PATCH] [Dashboard][Bugfix] Fix GPU List Bug (#12666) * Fix bug where None was passed as the empty value for ActorInfo.gpu_stats instead of an empty list * lint * dashboard/modules/logical_view * fix test * trigger build --- dashboard/datacenter.py | 7 ++----- .../modules/logical_view/tests/test_logical_view_head.py | 7 +++++++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/dashboard/datacenter.py b/dashboard/datacenter.py index 553ff713b..357bab3c1 100644 --- a/dashboard/datacenter.py +++ b/dashboard/datacenter.py @@ -238,7 +238,7 @@ class DataOrganizer: pid = core_worker_stats.get("pid") node_physical_stats = DataSource.node_physical_stats.get(node_id, {}) actor_process_stats = None - actor_process_gpu_stats = None + actor_process_gpu_stats = [] if pid: for process_stats in node_physical_stats.get("workers", []): if process_stats["pid"] == pid: @@ -248,14 +248,11 @@ class DataOrganizer: for gpu_stats in node_physical_stats.get("gpus", []): for process in gpu_stats.get("processes", []): if process["pid"] == pid: - actor_process_gpu_stats = gpu_stats + actor_process_gpu_stats.append(gpu_stats) break - if actor_process_gpu_stats is not None: - break actor["gpus"] = actor_process_gpu_stats actor["processStats"] = actor_process_stats - return actor @classmethod diff --git a/dashboard/modules/logical_view/tests/test_logical_view_head.py b/dashboard/modules/logical_view/tests/test_logical_view_head.py index 2db29b76d..2144918a4 100644 --- a/dashboard/modules/logical_view/tests/test_logical_view_head.py +++ b/dashboard/modules/logical_view/tests/test_logical_view_head.py @@ -54,6 +54,13 @@ def test_actor_groups(ray_start_with_dashboard): assert summary["stateToCount"]["ALIVE"] == 2 entries = actor_groups["Foo"]["entries"] + foo_entry = entries[0] + assert type(foo_entry["gpus"]) is list + assert "timestamp" in foo_entry + assert "actorConstructor" in foo_entry + assert "actorClass" in foo_entry + assert "actorId" in foo_entry + assert "ipAddress" in foo_entry assert len(entries) == 2 assert "InfeasibleActor" in actor_groups