Skip to content

Commit e76c422

Browse files
authored
Cleanup Rockset on ET benchmark dashboards (#5761)
This is a follow-up of #5758, let's just keep ClickHouse route going forward as it's tedious to update both ClickHouse and Rockset queries ### Testing https://torchci-git-fork-huydhn-cleanup-rockset-llm-e8a0f2-fbopensource.vercel.app/benchmark/llms?repoName=pytorch%2Fexecutorch and https://torchci-git-fork-huydhn-cleanup-rockset-llm-e8a0f2-fbopensource.vercel.app/benchmark/llms?repoName=pytorch%2Fpytorch
1 parent 701c772 commit e76c422

File tree

3 files changed

+34
-152
lines changed

3 files changed

+34
-152
lines changed

torchci/components/benchmark/llms/ModelGraphPanel.tsx

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import {
1919
} from "components/metrics/panels/TimeSeriesPanel";
2020
import dayjs from "dayjs";
2121
import { useBenchmark } from "lib/benchmark/llmUtils";
22-
import { RocksetParam } from "lib/rockset";
2322
import { BranchAndCommit } from "lib/types";
2423

2524
const GRAPH_ROW_HEIGHT = 245;
@@ -33,17 +32,15 @@ export function GraphPanel({
3332
metricNames,
3433
lBranchAndCommit,
3534
rBranchAndCommit,
36-
useClickHouse,
3735
}: {
38-
queryParams: RocksetParam[] | {};
36+
queryParams: { [key: string]: any };
3937
granularity: Granularity;
4038
modelName: string;
4139
dtypeName: string;
4240
deviceName: string;
4341
metricNames: string[];
4442
lBranchAndCommit: BranchAndCommit;
4543
rBranchAndCommit: BranchAndCommit;
46-
useClickHouse: boolean;
4744
}) {
4845
// Do not set the commit here to query all the records in the time range to
4946
// draw a chart
@@ -55,8 +52,7 @@ export function GraphPanel({
5552
{
5653
branch: rBranchAndCommit.branch,
5754
commit: "",
58-
},
59-
useClickHouse
55+
}
6056
);
6157

6258
if (data === undefined || data.length === 0) {
@@ -75,22 +71,12 @@ export function GraphPanel({
7571

7672
// Clamp to the nearest granularity (e.g. nearest hour) so that the times will
7773
// align with the data we get from the database
78-
const startTime = useClickHouse
79-
? dayjs((queryParams as { [key: string]: any })["startTime"]).startOf(
80-
granularity
81-
)
82-
: dayjs(
83-
(queryParams as RocksetParam[]).find((p) => p.name === "startTime")
84-
?.value
85-
).startOf(granularity);
86-
const stopTime = useClickHouse
87-
? dayjs((queryParams as { [key: string]: any })["stopTime"]).startOf(
88-
granularity
89-
)
90-
: dayjs(
91-
(queryParams as RocksetParam[]).find((p) => p.name === "stopTime")
92-
?.value
93-
).startOf(granularity);
74+
const startTime = dayjs(
75+
(queryParams as { [key: string]: any })["startTime"]
76+
).startOf(granularity);
77+
const stopTime = dayjs(
78+
(queryParams as { [key: string]: any })["stopTime"]
79+
).startOf(granularity);
9480

9581
// Only show records between these twos
9682
const lWorkflowId = COMMIT_TO_WORKFLOW_ID[lBranchAndCommit.commit];

torchci/lib/benchmark/llmUtils.ts

Lines changed: 13 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -3,71 +3,34 @@ import {
33
LLMsBenchmarkData,
44
} from "components/benchmark/llms/common";
55
import { fetcher } from "lib/GeneralUtils";
6-
import { RocksetParam } from "lib/rockset";
76
import { BranchAndCommit } from "lib/types";
87
import useSWR from "swr";
98

109
export function useBenchmark(
11-
queryParams: RocksetParam[] | {},
10+
queryParams: { [key: string]: any },
1211
modelName: string,
1312
dtypeName: string,
1413
deviceName: string,
1514
branchAndCommit: BranchAndCommit,
16-
useClickHouse: boolean = false,
1715
getJobId: boolean = false
1816
) {
1917
const queryCollection = "benchmarks";
2018
const queryName = "oss_ci_benchmark_llms";
2119

22-
const queryParamsWithBranchAndCommit:
23-
| RocksetParam[]
24-
| { [key: string]: any } = useClickHouse
25-
? {
26-
getJobId: getJobId,
27-
...queryParams,
28-
}
29-
: [
30-
{
31-
name: "getJobId",
32-
type: "bool",
33-
value: getJobId,
34-
},
35-
...(queryParams as RocksetParam[]),
36-
];
37-
38-
if (useClickHouse) {
39-
(queryParamsWithBranchAndCommit as { [key: string]: any })["branches"] =
40-
branchAndCommit.branch ? [branchAndCommit.branch] : [];
41-
} else {
42-
if (branchAndCommit.branch) {
43-
queryParamsWithBranchAndCommit.push({
44-
name: "branches",
45-
type: "string",
46-
value: branchAndCommit.branch,
47-
});
48-
}
49-
}
20+
const queryParamsWithBranchAndCommit: { [key: string]: any } = {
21+
getJobId: getJobId,
22+
...queryParams,
23+
};
5024

51-
if (useClickHouse) {
52-
(queryParamsWithBranchAndCommit as { [key: string]: any })["commits"] =
53-
branchAndCommit.commit ? [branchAndCommit.commit] : [];
54-
} else {
55-
if (branchAndCommit.commit) {
56-
queryParamsWithBranchAndCommit.push({
57-
name: "commits",
58-
type: "string",
59-
value: branchAndCommit.commit,
60-
});
61-
}
62-
}
25+
(queryParamsWithBranchAndCommit as { [key: string]: any })["branches"] =
26+
branchAndCommit.branch ? [branchAndCommit.branch] : [];
27+
28+
(queryParamsWithBranchAndCommit as { [key: string]: any })["commits"] =
29+
branchAndCommit.commit ? [branchAndCommit.commit] : [];
6330

64-
const url = useClickHouse
65-
? `/api/clickhouse/${queryName}?parameters=${encodeURIComponent(
66-
JSON.stringify(queryParamsWithBranchAndCommit)
67-
)}`
68-
: `/api/query/${queryCollection}/${queryName}?parameters=${encodeURIComponent(
69-
JSON.stringify(queryParamsWithBranchAndCommit)
70-
)}`;
31+
const url = `/api/clickhouse/${queryName}?parameters=${encodeURIComponent(
32+
JSON.stringify(queryParamsWithBranchAndCommit)
33+
)}`;
7134

7235
return useSWR(url, fetcher, {
7336
refreshInterval: 60 * 60 * 1000, // refresh every hour

torchci/pages/benchmark/llms.tsx

Lines changed: 13 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,15 @@ import { DTypePicker } from "components/benchmark/ModeAndDTypePicker";
1919
import CopyLink from "components/CopyLink";
2020
import GranularityPicker from "components/GranularityPicker";
2121
import { Granularity } from "components/metrics/panels/TimeSeriesPanel";
22-
import { useCHContext } from "components/UseClickhouseProvider";
2322
import dayjs from "dayjs";
2423
import { useBenchmark } from "lib/benchmark/llmUtils";
2524
import { fetcher } from "lib/GeneralUtils";
26-
import { RocksetParam } from "lib/rockset";
2725
import { BranchAndCommit } from "lib/types";
2826
import _ from "lodash";
2927
import { useRouter } from "next/router";
3028
import { useEffect, useState } from "react";
3129
import useSWR from "swr";
32-
import { RStoCHTimeParams, TimeRangePicker } from "../metrics";
30+
import { TimeRangePicker } from "../metrics";
3331

3432
function Report({
3533
queryParams,
@@ -43,9 +41,8 @@ function Report({
4341
metricNames,
4442
lBranchAndCommit,
4543
rBranchAndCommit,
46-
useClickHouse,
4744
}: {
48-
queryParams: RocksetParam[] | {};
45+
queryParams: { [key: string]: any };
4946
startTime: dayjs.Dayjs;
5047
stopTime: dayjs.Dayjs;
5148
granularity: Granularity;
@@ -56,15 +53,13 @@ function Report({
5653
metricNames: string[];
5754
lBranchAndCommit: BranchAndCommit;
5855
rBranchAndCommit: BranchAndCommit;
59-
useClickHouse: boolean;
6056
}) {
6157
const { data: lData, error: _lError } = useBenchmark(
6258
queryParams,
6359
modelName,
6460
dtypeName,
6561
deviceName,
6662
lBranchAndCommit,
67-
useClickHouse,
6863
true
6964
);
7065
const { data: rData, error: _rError } = useBenchmark(
@@ -73,7 +68,6 @@ function Report({
7368
dtypeName,
7469
deviceName,
7570
rBranchAndCommit,
76-
useClickHouse,
7771
true
7872
);
7973

@@ -123,7 +117,6 @@ function Report({
123117
metricNames={metricNames}
124118
lBranchAndCommit={lBranchAndCommit}
125119
rBranchAndCommit={rBranchAndCommit}
126-
useClickHouse={useClickHouse}
127120
/>
128121
<SummaryPanel
129122
startTime={startTime}
@@ -164,9 +157,6 @@ export default function Page() {
164157
const [dtypeName, setDTypeName] = useState<string>(DEFAULT_DTYPE_NAME);
165158
const [deviceName, setDeviceName] = useState<string>(DEFAULT_DEVICE_NAME);
166159

167-
// TODO (huydhn): Clean this up once ClickHouse migration finishes
168-
const { useCH: useClickHouse } = useCHContext();
169-
170160
// Set the dropdown value what is in the param
171161
useEffect(() => {
172162
const startTime: string = (router.query.startTime as string) ?? undefined;
@@ -242,77 +232,21 @@ export default function Page() {
242232

243233
const queryCollection = "benchmarks";
244234
const queryName = "oss_ci_benchmark_names";
245-
246-
const timeParams: RocksetParam[] = [
247-
{
248-
name: "startTime",
249-
type: "string",
250-
value: startTime,
251-
},
252-
{
253-
name: "stopTime",
254-
type: "string",
255-
value: stopTime,
256-
},
257-
];
258-
const timeParamsClickHouse = RStoCHTimeParams(timeParams);
259-
260-
const queryParams: RocksetParam[] = [
261-
{
262-
name: "deviceArch",
263-
type: "string",
264-
value: deviceName === DEFAULT_DEVICE_NAME ? "" : deviceName,
265-
},
266-
{
267-
name: "dtypes",
268-
type: "string",
269-
value: dtypeName === DEFAULT_DTYPE_NAME ? "" : dtypeName,
270-
},
271-
{
272-
name: "excludedMetrics",
273-
type: "string",
274-
value: EXCLUDED_METRICS.join(","),
275-
},
276-
{
277-
name: "filenames",
278-
type: "string",
279-
value: REPO_TO_BENCHMARKS[repoName].join(","),
280-
},
281-
{
282-
name: "granularity",
283-
type: "string",
284-
value: granularity,
285-
},
286-
{
287-
name: "names",
288-
type: "string",
289-
value: modelName === DEFAULT_MODEL_NAME ? "" : modelName,
290-
},
291-
{
292-
name: "repo",
293-
type: "string",
294-
value: repoName,
295-
},
296-
...timeParams,
297-
];
298-
const queryParamsClickHouse = {
235+
const queryParams = {
299236
deviceArch: deviceName === DEFAULT_DEVICE_NAME ? "" : deviceName,
300237
dtypes: dtypeName === DEFAULT_DTYPE_NAME ? [] : [dtypeName],
301238
excludedMetrics: EXCLUDED_METRICS,
302239
filenames: REPO_TO_BENCHMARKS[repoName],
303240
granularity: granularity,
304241
names: modelName === DEFAULT_MODEL_NAME ? [] : [modelName],
305242
repo: repoName,
306-
...timeParamsClickHouse,
243+
startTime: dayjs(startTime).utc().format("YYYY-MM-DDTHH:mm:ss.SSS"),
244+
stopTime: dayjs(stopTime).utc().format("YYYY-MM-DDTHH:mm:ss.SSS"),
307245
};
308246

309-
const url = useClickHouse
310-
? `/api/clickhouse/${queryName}?parameters=${encodeURIComponent(
311-
JSON.stringify(queryParamsClickHouse)
312-
)}`
313-
: `/api/query/${queryCollection}/${queryName}?parameters=${encodeURIComponent(
314-
JSON.stringify(queryParams)
315-
)}`;
247+
const url = `/api/clickhouse/${queryName}?parameters=${encodeURIComponent(
248+
JSON.stringify(queryParams)
249+
)}`;
316250

317251
const { data } = useSWR(url, fetcher, {
318252
refreshInterval: 60 * 60 * 1000, // refresh every hour
@@ -391,36 +325,36 @@ export default function Page() {
391325
<BranchAndCommitPicker
392326
queryName={"oss_ci_benchmark_branches"}
393327
queryCollection={"benchmarks"}
394-
queryParams={useClickHouse ? queryParamsClickHouse : queryParams}
328+
queryParams={queryParams}
395329
branch={lBranch}
396330
setBranch={setLBranch}
397331
commit={lCommit}
398332
setCommit={setLCommit}
399333
titlePrefix={"Base"}
400334
fallbackIndex={1} // Default to previous commit
401335
timeRange={timeRange}
402-
useClickHouse={useClickHouse}
336+
useClickHouse={true}
403337
/>
404338
<Divider orientation="vertical" flexItem>
405339
&mdash;Diff→
406340
</Divider>
407341
<BranchAndCommitPicker
408342
queryName={"oss_ci_benchmark_branches"}
409343
queryCollection={"benchmarks"}
410-
queryParams={useClickHouse ? queryParamsClickHouse : queryParams}
344+
queryParams={queryParams}
411345
branch={rBranch}
412346
setBranch={setRBranch}
413347
commit={rCommit}
414348
setCommit={setRCommit}
415349
titlePrefix={"New"}
416350
fallbackIndex={0} // Default to the latest commit
417351
timeRange={timeRange}
418-
useClickHouse={useClickHouse}
352+
useClickHouse={true}
419353
/>
420354
</Stack>
421355

422356
<Report
423-
queryParams={useClickHouse ? queryParamsClickHouse : queryParams}
357+
queryParams={queryParams}
424358
startTime={startTime}
425359
stopTime={stopTime}
426360
granularity={granularity}
@@ -431,7 +365,6 @@ export default function Page() {
431365
metricNames={metricNames}
432366
lBranchAndCommit={{ branch: lBranch, commit: lCommit }}
433367
rBranchAndCommit={{ branch: rBranch, commit: rCommit }}
434-
useClickHouse={useClickHouse}
435368
/>
436369
</div>
437370
);

0 commit comments

Comments
 (0)