From 9375e240cc08cfcf3c5e74a1cbd5c87509e61bd7 Mon Sep 17 00:00:00 2001 From: can Date: Tue, 19 Nov 2024 20:54:43 +0000 Subject: [PATCH] [data][dashboard] fix confusing dataset operator name Signed-off-by: can --- .../dashboard/client/src/components/DataOverviewTable.tsx | 2 +- .../client/src/pages/data/DataOverview.component.test.tsx | 7 ++++--- python/ray/dashboard/client/src/type/data.ts | 1 + python/ray/dashboard/modules/data/tests/test_data_head.py | 2 ++ python/ray/data/_internal/execution/streaming_executor.py | 1 + python/ray/data/tests/test_stats.py | 1 + 6 files changed, 10 insertions(+), 4 deletions(-) diff --git a/python/ray/dashboard/client/src/components/DataOverviewTable.tsx b/python/ray/dashboard/client/src/components/DataOverviewTable.tsx index c52bdee0c28b..c3538ba9ccd4 100644 --- a/python/ray/dashboard/client/src/components/DataOverviewTable.tsx +++ b/python/ray/dashboard/client/src/components/DataOverviewTable.tsx @@ -193,7 +193,7 @@ const DataRow = ({ {isDatasetRow && datasetMetrics.dataset} - {isOperatorRow && operatorMetrics.operator} + {isOperatorRow && operatorMetrics.name} { operators: [ { operator: "test_ds1_op1", + name: "test_ds1_op", state: "RUNNING", progress: 99, total: 101, @@ -104,11 +105,11 @@ describe("DataOverview", () => { expect(screen.getByText("70/80")).toBeVisible(); // Operator dropdown - expect(screen.queryByText("test_ds1_op1")).toBeNull(); + expect(screen.queryByText("test_ds1_op")).toBeNull(); await user.click(screen.getByTitle("Expand Dataset test_ds1")); - expect(screen.getByText("test_ds1_op1")).toBeVisible(); + expect(screen.getByText("test_ds1_op")).toBeVisible(); await user.click(screen.getByTitle("Collapse Dataset test_ds1")); - expect(screen.queryByText("test_ds1_op1")).toBeNull(); + expect(screen.queryByText("test_ds1_op")).toBeNull(); // Second Dataset expect(screen.getByText("test_ds2")).toBeVisible(); diff --git a/python/ray/dashboard/client/src/type/data.ts b/python/ray/dashboard/client/src/type/data.ts index dbbfc5889238..64d91a006568 100644 --- a/python/ray/dashboard/client/src/type/data.ts +++ b/python/ray/dashboard/client/src/type/data.ts @@ -12,6 +12,7 @@ export type DatasetMetrics = DataMetrics & { export type OperatorMetrics = DataMetrics & { operator: string; + name: string; }; export type DataMetrics = { diff --git a/python/ray/dashboard/modules/data/tests/test_data_head.py b/python/ray/dashboard/modules/data/tests/test_data_head.py index 650079360a8b..4b18e6e482fd 100644 --- a/python/ray/dashboard/modules/data/tests/test_data_head.py +++ b/python/ray/dashboard/modules/data/tests/test_data_head.py @@ -13,6 +13,7 @@ DATA_HEAD_URLS = {"GET": "http://localhost:8265/api/data/datasets/{job_id}"} DATA_SCHEMA = [ + "name", "state", "progress", "total", @@ -66,6 +67,7 @@ def test_get_datasets(): op0 = operators[0] assert sorted(op0.keys()) == sorted(OPERATOR_SCHEMA) assert op0["operator"] == "Input0" + assert op0["name"] == "Input" assert op0["progress"] == 20 assert op0["total"] == 20 assert op0["state"] == "FINISHED" diff --git a/python/ray/data/_internal/execution/streaming_executor.py b/python/ray/data/_internal/execution/streaming_executor.py index ca48d7766c35..a4276e2bafe6 100644 --- a/python/ray/data/_internal/execution/streaming_executor.py +++ b/python/ray/data/_internal/execution/streaming_executor.py @@ -399,6 +399,7 @@ def _get_state_dict(self, state): "end_time": time.time() if state != "RUNNING" else None, "operators": { f"{op.name}{i}": { + "name": op.name, "progress": op_state.num_completed_tasks, "total": op.num_outputs_total(), "state": state, diff --git a/python/ray/data/tests/test_stats.py b/python/ray/data/tests/test_stats.py index cb0d31f22774..a41e060fb3f5 100644 --- a/python/ray/data/tests/test_stats.py +++ b/python/ray/data/tests/test_stats.py @@ -1648,6 +1648,7 @@ def test_stats_actor_datasets(ray_start_cluster): assert "Input0" in operators assert "ReadRange->MapBatches()1" in operators for value in operators.values(): + assert value["name"] in ["Input", "ReadRange->MapBatches()"] assert value["progress"] == 20 assert value["total"] == 20 assert value["state"] == "FINISHED"