Skip to content

Commit 1faa4b5

Browse files
authored
[Utilization] Set up Job level profile, and test detail mechanism (#6264)
# Description show job profile information such as duration, cpu, gpu count etc. show the total statisctics table for the whole job. show detected testsand tests' segmented Statistics Table Currently we only show max aggregate data, the max agg: we get the max of a utilization percentage during the 5 sec collect interval. the avg agg: we get the avg of all utilization percentage during the 5 sec collect interval ## Statistics Table show all hardware's max aggregated data for avg, 10p,90p and 90% utilizaiton spike info. Will add analysis seciton for the statistics in next step ## Demo working vercel demo link: Job with GPU: https://torchci-qrqc2igy4-fbopensource.vercel.app/utilization/13143119394/36681447812/1 Job without GPU: https://torchci-qrqc2igy4-fbopensource.vercel.app/utilization/12937937547/36088234580/1 ### Job Profile Details workflow and job information, duration, hardware count information a statisctics table shows how the whole job's utilization behaves. ![testProfile](https://github.com/user-attachments/assets/d996b752-3bfd-420c-b54c-3169acfb240b) ### View Tests Two options to view detected test details: - list view: click on test based on test name - chart view: click on test segment in chart #### Choose single test from list view ![listView](https://github.com/user-attachments/assets/097ec959-f2ad-41d9-a8f4-5ee60a52ec98) ### choose singl test from chart view ![chartview](https://github.com/user-attachments/assets/08d4e942-1feb-4011-9a3a-d34e2df83d2a) ## Other remove .curve(d3.curveBasis) from the svg since it does not render svg accurate ## Next step add more test related rendering and table for test improvement recommendation
1 parent 8dc6c25 commit 1faa4b5

21 files changed

+1148
-102
lines changed

torchci/components/charts/line_rect_chart/LineRectChart.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ import { processLineData, processRectData, setDimensions } from "./lib/utils";
1111
import styles from "./LineChart.module.css";
1212

1313
type Props = {
14-
onDataChange?: (data: any) => void;
14+
onClickedRect?: (id: string) => void;
1515
inputLines?: TimeSeriesWrapper[];
1616
rects?: {
1717
name: string;
1818
start_at: string;
1919
end_at: string;
2020
color?: string;
21+
opacity?: number;
2122
}[];
2223
chartWidth?: number;
2324
disableRect?: boolean;
@@ -27,7 +28,7 @@ type Props = {
2728
};
2829

2930
const LineRectChart = ({
30-
onDataChange = (data: any) => void {},
31+
onClickedRect = (id: string) => void {},
3132
inputLines,
3233
rects,
3334
chartWidth,
@@ -144,6 +145,7 @@ const LineRectChart = ({
144145
setLineTooltip={setLineTooltip}
145146
/>
146147
<RenderSvgRects
148+
onClickedRect={onClickedRect}
147149
setRectTooltip={setRectTooltip}
148150
rectangles={rectangles}
149151
disableRect={disableRect}

torchci/components/charts/line_rect_chart/component/RenderLineChartComponents.module.css

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,9 @@
1717
opacity: 0.7;
1818
}
1919

20-
.rect {
21-
opacity: 0.2;
22-
}
23-
2420
.rect:hover {
2521
fill: blue;
26-
opacity: 0.5;
22+
opacity: 0.7;
2723
}
2824
.rect:active {
2925
fill: red;

torchci/components/charts/line_rect_chart/component/RenderSvgLine.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ const RenderSvgLines = ({
1717
const lineGenerator = d3
1818
.line<D3LineRecord>()
1919
.x((d: D3LineRecord) => scales.xScale(d.date))
20-
.y((d: D3LineRecord) => scales.yScale(d.value))
21-
.curve(d3.curveBasis);
22-
20+
.y((d: D3LineRecord) => scales.yScale(d.value));
2321
return (
2422
<g className="lines-group">
2523
{lines.map((line, i) => {

torchci/components/charts/line_rect_chart/component/RenderSvgRect.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { formatDate } from "../lib/utils";
55
import styles from "./RenderLineChartComponents.module.css";
66

77
const RenderSvgRects = ({
8+
onClickedRect,
89
setRectTooltip,
910
rectangles,
1011
disableRect,
@@ -21,6 +22,7 @@ const RenderSvgRects = ({
2122
};
2223
}>
2324
>;
25+
onClickedRect: (id: any) => void;
2426
rectangles: RectangleData[];
2527
disableRect?: boolean;
2628
dimensions: any;
@@ -45,7 +47,9 @@ const RenderSvgRects = ({
4547
rectData: RectangleData
4648
) => {
4749
if (disableRect) return;
48-
//onDataChange(): todo handle the onclick event
50+
51+
console.log("RenderSvgRects", rectData);
52+
onClickedRect(rectData.name);
4953
};
5054

5155
// handle rect svg events
@@ -68,6 +72,7 @@ const RenderSvgRects = ({
6872
<rect
6973
key={i}
7074
className={`${styles.rect} rect`}
75+
opacity={rec.opacity ? rec.opacity : 0.5}
7176
fill={rec.color ? rec.color : getRandomColor(i)}
7277
id={rec.name}
7378
display={disableRect ? "none" : "block"}

torchci/components/charts/line_rect_chart/lib/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ export interface RectangleData {
33
start: Date;
44
end: Date;
55
color?: string;
6+
opacity?: number;
67
}
78

89
export interface TimeData {

torchci/components/charts/line_rect_chart/lib/utils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export function processRectData(
4242
start_at: string;
4343
end_at: string;
4444
color?: string;
45+
opacity?: number;
4546
}[]
4647
) {
4748
if (!rectangles || rectangles.length == 0) {
@@ -54,6 +55,7 @@ export function processRectData(
5455
start: convertDate(el.start_at),
5556
end: convertDate(el.end_at),
5657
color: el.color,
58+
opacity: el.opacity,
5759
};
5860
});
5961
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import {
2+
FormControl,
3+
MenuItem,
4+
Select,
5+
SelectChangeEvent,
6+
} from "@mui/material";
7+
import { useEffect, useState } from "react";
8+
9+
export default function DropDownList({
10+
onChange,
11+
defaultValue,
12+
options,
13+
}: {
14+
onChange: (value: string) => void;
15+
defaultValue?: string;
16+
options: { value: string; name: string }[];
17+
}) {
18+
const [value, setValue] = useState<string>("");
19+
20+
useEffect(() => {
21+
if (defaultValue) {
22+
setValue(defaultValue);
23+
} else {
24+
setValue("none");
25+
}
26+
}, [defaultValue]);
27+
28+
const handleChange = (event: SelectChangeEvent) => {
29+
setValue(event.target.value);
30+
onChange(event.target.value);
31+
};
32+
return (
33+
<div>
34+
<FormControl sx={{ m: 1, minWidth: 80 }}>
35+
<Select value={value} onChange={handleChange} autoWidth>
36+
{defaultValue == undefined ? (
37+
<MenuItem value="none">None</MenuItem>
38+
) : null}
39+
{options.map((option, idx) => {
40+
return (
41+
<MenuItem key={idx} value={option.value}>
42+
{option.name}
43+
</MenuItem>
44+
);
45+
})}
46+
</Select>
47+
</FormControl>
48+
</div>
49+
);
50+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import { ToggleButton, ToggleButtonGroup } from "@mui/material";
2+
import React, { useEffect } from "react";
3+
4+
interface ToggleGroupProps {
5+
defaultValue: string;
6+
items: ToggleButtonItem[];
7+
onChange?: (value: string) => void;
8+
}
9+
10+
interface ToggleButtonItem {
11+
name: string;
12+
value: string;
13+
}
14+
15+
export const ToggleGroup = ({
16+
defaultValue,
17+
items,
18+
onChange = () => {},
19+
}: ToggleGroupProps) => {
20+
const [alignment, setAlignment] = React.useState("");
21+
22+
const handleChange = (
23+
event: React.MouseEvent<HTMLElement>,
24+
newAlignment: string
25+
) => {
26+
setAlignment(newAlignment);
27+
onChange(newAlignment);
28+
};
29+
30+
useEffect(() => {
31+
if (defaultValue) {
32+
setAlignment(defaultValue);
33+
} else {
34+
setAlignment("none");
35+
}
36+
}, [defaultValue, items]);
37+
38+
return (
39+
<ToggleButtonGroup
40+
color="primary"
41+
value={alignment}
42+
exclusive
43+
onChange={handleChange}
44+
aria-label="Platform"
45+
>
46+
{!defaultValue && <ToggleButton value="none">None</ToggleButton>}
47+
{items.map((item) => {
48+
return (
49+
<ToggleButton key={item.name} value={item.value}>
50+
{item.name}
51+
</ToggleButton>
52+
);
53+
})}
54+
</ToggleButtonGroup>
55+
);
56+
};

0 commit comments

Comments
 (0)