Skip to content

Commit

Permalink
[data][dashboard] fix confusing dataset operator name
Browse files Browse the repository at this point in the history
Signed-off-by: can <[email protected]>
  • Loading branch information
can-anyscale committed Nov 22, 2024
1 parent d4476ac commit e36faf2
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ const DataRow = ({
</TableCell>
<TableCell align="left">
{isDatasetRow && datasetMetrics.dataset}
{isOperatorRow && operatorMetrics.operator}
{isOperatorRow && operatorMetrics.name}
</TableCell>
<TableCell align="right" style={{ width: 200 }}>
<TaskProgressBar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ describe("DataOverview", () => {
operators: [
{
operator: "test_ds1_op1",
name: "test_ds1_op",
state: "RUNNING",
progress: 99,
total: 101,
Expand Down Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions python/ray/dashboard/client/src/type/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export type DatasetMetrics = DataMetrics & {

export type OperatorMetrics = DataMetrics & {
operator: string;
name: string;
};

export type DataMetrics = {
Expand Down
24 changes: 18 additions & 6 deletions python/ray/dashboard/modules/data/tests/test_data_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
] + DATA_SCHEMA

OPERATOR_SCHEMA = [
"name",
"operator",
] + DATA_SCHEMA

Expand Down Expand Up @@ -64,12 +65,23 @@ def test_get_datasets():
operators = dataset["operators"]
assert len(operators) == 2
op0 = operators[0]
op1 = operators[1]
assert sorted(op0.keys()) == sorted(OPERATOR_SCHEMA)
assert op0["operator"] == "Input0"
assert op0["progress"] == 20
assert op0["total"] == 20
assert op0["state"] == "FINISHED"
assert operators[1]["operator"] == "ReadRange->MapBatches(<lambda>)1"
assert sorted(op1.keys()) == sorted(OPERATOR_SCHEMA)
assert {
"operator": "Input0",
"name": "Input",
"state": "FINISHED",
"progress": 20,
"total": 20,
}.items() <= op0.items()
assert {
"operator": "ReadRange->MapBatches(<lambda>)1",
"name": "ReadRange->MapBatches(<lambda>)",
"state": "FINISHED",
"progress": 20,
"total": 20,
}.items() <= op1.items()

ds.map_batches(lambda x: x).materialize()
data = requests.get(DATA_HEAD_URLS["GET"].format(job_id=job_id)).json()
Expand All @@ -83,4 +95,4 @@ def test_get_datasets():


if __name__ == "__main__":
sys.exit(pytest.main(["-v", __file__]))
sys.exit(pytest.main(["-vv", __file__]))
1 change: 1 addition & 0 deletions python/ray/data/_internal/execution/streaming_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions python/ray/data/tests/test_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -1648,6 +1648,7 @@ def test_stats_actor_datasets(ray_start_cluster):
assert "Input0" in operators
assert "ReadRange->MapBatches(<lambda>)1" in operators
for value in operators.values():
assert value["name"] in ["Input", "ReadRange->MapBatches(<lambda>)"]
assert value["progress"] == 20
assert value["total"] == 20
assert value["state"] == "FINISHED"
Expand Down

0 comments on commit e36faf2

Please sign in to comment.