-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[data] Ray Data jobs detail table (#40756)
Creates a table under the jobs page to display dataset-level metrics. The `_StatsActor` now stores dataset metadata like `state`, `progress` and `start/end_time` for each executed dataset, that is directly queried by the new `data_head` dashboard api. This api also makes requests to the prometheus server to get other metrics that are displayed. Signed-off-by: Andrew Xue <andewzxue@gmail.com>
- Loading branch information
Showing
16 changed files
with
566 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
import { | ||
Box, | ||
Table, | ||
TableBody, | ||
TableCell, | ||
TableHead, | ||
TableRow, | ||
TextField, | ||
TextFieldProps, | ||
Typography, | ||
} from "@material-ui/core"; | ||
import Autocomplete from "@material-ui/lab/Autocomplete"; | ||
import Pagination from "@material-ui/lab/Pagination"; | ||
import React, { useState } from "react"; | ||
import { formatDateFromTimeMs } from "../common/formatUtils"; | ||
import rowStyles from "../common/RowStyles"; | ||
import { TaskProgressBar } from "../pages/job/TaskProgressBar"; | ||
import { DatasetMetrics } from "../type/data"; | ||
import { memoryConverter } from "../util/converter"; | ||
import { useFilter } from "../util/hook"; | ||
import StateCounter from "./StatesCounter"; | ||
import { StatusChip } from "./StatusChip"; | ||
import { HelpInfo } from "./Tooltip"; | ||
|
||
const columns = [ | ||
{ label: "Dataset" }, | ||
{ | ||
label: "Progress", | ||
helpInfo: <Typography>Blocks outputted by output operator.</Typography>, | ||
}, | ||
{ label: "State" }, | ||
{ label: "Bytes Outputted" }, | ||
{ | ||
label: "Memory Usage (Current / Max)", | ||
helpInfo: ( | ||
<Typography> | ||
Amount of object store memory used by a dataset. Includes spilled | ||
objects. | ||
</Typography> | ||
), | ||
}, | ||
{ | ||
label: "Bytes Spilled", | ||
helpInfo: ( | ||
<Typography> | ||
Set | ||
"ray.data.context.DataContext.get_current().enable_get_object_locations_for_metrics | ||
= True" to collect spill stats. | ||
</Typography> | ||
), | ||
}, | ||
{ label: "Start Time" }, | ||
{ label: "End Time" }, | ||
]; | ||
|
||
const DataOverviewTable = ({ | ||
datasets = [], | ||
}: { | ||
datasets: DatasetMetrics[]; | ||
}) => { | ||
const [pageNo, setPageNo] = useState(1); | ||
const { changeFilter, filterFunc } = useFilter(); | ||
const pageSize = 10; | ||
const datasetList = datasets.filter(filterFunc); | ||
|
||
const list = datasetList.slice((pageNo - 1) * pageSize, pageNo * pageSize); | ||
|
||
const classes = rowStyles(); | ||
|
||
return ( | ||
<div> | ||
<div style={{ flex: 1, display: "flex", alignItems: "center" }}> | ||
<Autocomplete | ||
style={{ margin: 8, width: 120 }} | ||
options={Array.from(new Set(datasets.map((e) => e.dataset)))} | ||
onInputChange={(_: any, value: string) => { | ||
changeFilter("dataset", value.trim()); | ||
}} | ||
renderInput={(params: TextFieldProps) => ( | ||
<TextField {...params} label="Dataset" /> | ||
)} | ||
/> | ||
</div> | ||
<div style={{ display: "flex", alignItems: "center" }}> | ||
<div> | ||
<Pagination | ||
page={pageNo} | ||
onChange={(e, num) => setPageNo(num)} | ||
count={Math.ceil(datasetList.length / pageSize)} | ||
/> | ||
</div> | ||
<div> | ||
<StateCounter type="task" list={datasetList} /> | ||
</div> | ||
</div> | ||
<div className={classes.tableContainer}> | ||
<Table> | ||
<TableHead> | ||
<TableRow> | ||
{columns.map(({ label, helpInfo }) => ( | ||
<TableCell align="center" key={label}> | ||
<Box | ||
display="flex" | ||
justifyContent="center" | ||
alignItems="center" | ||
> | ||
{label} | ||
{helpInfo && ( | ||
<HelpInfo className={classes.helpInfo}> | ||
{helpInfo} | ||
</HelpInfo> | ||
)} | ||
</Box> | ||
</TableCell> | ||
))} | ||
</TableRow> | ||
</TableHead> | ||
<TableBody> | ||
{list.map( | ||
({ | ||
dataset, | ||
state, | ||
ray_data_current_bytes, | ||
ray_data_output_bytes, | ||
ray_data_spilled_bytes, | ||
progress, | ||
total, | ||
start_time, | ||
end_time, | ||
}) => ( | ||
<TableRow key={dataset}> | ||
<TableCell align="center">{dataset}</TableCell> | ||
<TableCell align="center"> | ||
<TaskProgressBar | ||
numFinished={progress} | ||
numRunning={ | ||
state === "RUNNING" ? total - progress : undefined | ||
} | ||
numCancelled={ | ||
state === "FAILED" ? total - progress : undefined | ||
} | ||
total={total} | ||
/> | ||
</TableCell> | ||
<TableCell align="center"> | ||
<StatusChip type="task" status={state} /> | ||
</TableCell> | ||
<TableCell align="center"> | ||
{memoryConverter(Number(ray_data_output_bytes.max))} | ||
</TableCell> | ||
<TableCell align="center"> | ||
{memoryConverter(Number(ray_data_current_bytes.value))}/ | ||
{memoryConverter(Number(ray_data_current_bytes.max))} | ||
</TableCell> | ||
<TableCell align="center"> | ||
{memoryConverter(Number(ray_data_spilled_bytes.max))} | ||
</TableCell> | ||
<TableCell align="center"> | ||
{formatDateFromTimeMs(start_time * 1000)} | ||
</TableCell> | ||
<TableCell align="center"> | ||
{end_time && formatDateFromTimeMs(end_time * 1000)} | ||
</TableCell> | ||
</TableRow> | ||
), | ||
)} | ||
</TableBody> | ||
</Table> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default DataOverviewTable; |
69 changes: 69 additions & 0 deletions
69
dashboard/client/src/pages/data/DataOverview.component.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import { render, screen } from "@testing-library/react"; | ||
import React from "react"; | ||
import { TEST_APP_WRAPPER } from "../../util/test-utils"; | ||
import DataOverview from "./DataOverview"; | ||
|
||
describe("DataOverview", () => { | ||
it("renders table with dataset metrics", async () => { | ||
const datasets = [ | ||
{ | ||
dataset: "test_ds1", | ||
state: "RUNNING", | ||
progress: 50, | ||
total: 100, | ||
start_time: 0, | ||
end_time: undefined, | ||
ray_data_output_bytes: { | ||
max: 10, | ||
}, | ||
ray_data_spilled_bytes: { | ||
max: 20, | ||
}, | ||
ray_data_current_bytes: { | ||
value: 30, | ||
max: 40, | ||
}, | ||
}, | ||
{ | ||
dataset: "test_ds2", | ||
state: "FINISHED", | ||
progress: 200, | ||
total: 200, | ||
start_time: 1, | ||
end_time: 2, | ||
ray_data_output_bytes: { | ||
max: 50, | ||
}, | ||
ray_data_spilled_bytes: { | ||
max: 60, | ||
}, | ||
ray_data_current_bytes: { | ||
value: 70, | ||
max: 80, | ||
}, | ||
}, | ||
]; | ||
|
||
render(<DataOverview datasets={datasets} />, { wrapper: TEST_APP_WRAPPER }); | ||
|
||
// First Dataset | ||
expect(screen.getByText("test_ds1")).toBeVisible(); | ||
expect(screen.getByText("Total: 100")).toBeVisible(); | ||
expect(screen.getByText("Finished: 50")).toBeVisible(); | ||
expect(screen.getByText("Running: 50")).toBeVisible(); | ||
expect(screen.getByText("1969/12/31 16:00:00")).toBeVisible(); | ||
expect(screen.getByText("10.0000B")).toBeVisible(); | ||
expect(screen.getByText("20.0000B")).toBeVisible(); | ||
expect(screen.getByText("30.0000B/40.0000B")).toBeVisible(); | ||
|
||
// Second Dataset | ||
expect(screen.getByText("test_ds2")).toBeVisible(); | ||
expect(screen.getByText("Total: 200")).toBeVisible(); | ||
expect(screen.getByText("Finished: 200")).toBeVisible(); | ||
expect(screen.getByText("1969/12/31 16:00:01")).toBeVisible(); | ||
expect(screen.getByText("1969/12/31 16:00:02")).toBeVisible(); | ||
expect(screen.getByText("50.0000B")).toBeVisible(); | ||
expect(screen.getByText("60.0000B")).toBeVisible(); | ||
expect(screen.getByText("70.0000B/80.0000B")).toBeVisible(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React from "react"; | ||
import DataOverviewTable from "../../components/DataOverviewTable"; | ||
import { DatasetMetrics } from "../../type/data"; | ||
|
||
const DataOverview = ({ datasets = [] }: { datasets: DatasetMetrics[] }) => { | ||
return ( | ||
<div> | ||
<DataOverviewTable datasets={datasets} /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default DataOverview; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { DatasetResponse } from "../type/data"; | ||
import { get } from "./requestHandlers"; | ||
|
||
export const getDataDatasets = () => { | ||
return get<DatasetResponse>("api/data/datasets"); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
export type DatasetResponse = { | ||
datasets: DatasetMetrics[]; | ||
}; | ||
|
||
export type DatasetMetrics = { | ||
dataset: string; | ||
state: string; | ||
ray_data_current_bytes: { | ||
value: number; | ||
max: number; | ||
}; | ||
ray_data_output_bytes: { | ||
max: number; | ||
}; | ||
ray_data_spilled_bytes: { | ||
max: number; | ||
}; | ||
progress: number; | ||
total: number; | ||
start_time: number; | ||
end_time: number | undefined; | ||
}; |
Oops, something went wrong.