-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Utilization] Setup API and UI Inital page (#6240)
# Description Setup API and UI for utilization time series. Currently hooked with clickhouse fortesting tables to unblock UI development while waiting for the datapipline code merged. working api: https://torchci-git-utiltest-fbopensource.vercel.app/api/utilization/12937937547/36088234580/1 working UI rendering: https://torchci-git-utiltest-fbopensource.vercel.app/utilization/12937937547/36088234580/1 ##Details - set up sql, methods and API to fetch data from clickhouse - Add unittest for complicated logics - set up Page for utilization
- Loading branch information
Showing
13 changed files
with
743 additions
and
0 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
10 changes: 10 additions & 0 deletions
10
torchci/clickhouse_queries/oss_ci_util_metadata/params.json
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,10 @@ | ||
{ | ||
"params": { | ||
"workflowId": "UInt64", | ||
"jobId": "UInt64", | ||
"runAttempt": "UInt32", | ||
"repo": "String", | ||
"type": "String" | ||
}, | ||
"tests":[] | ||
} |
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,21 @@ | ||
--- This query is used by utilization dashboard | ||
-- TODO(): change to misc. once the pipeline is ready, currently fetch data from fortesting for development | ||
SELECT | ||
usage_collect_interval AS collect_interval, | ||
data_model_version AS model_version, | ||
gpu_count, | ||
cpu_count, | ||
created_at, | ||
workflow_name, | ||
job_name, | ||
start_at, | ||
end_at, | ||
segments, | ||
tags | ||
FROM | ||
fortesting.oss_ci_utilization_metadata | ||
WHERE | ||
workflow_id = { workflowId: UInt64} | ||
AND run_attempt = {runAttempt: UInt32} | ||
AND job_id = {jobId: UInt64} | ||
AND repo = {repo: String } |
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,10 @@ | ||
{ | ||
"params": { | ||
"workflowId": "UInt64", | ||
"jobId": "UInt64", | ||
"runAttempt": "UInt32", | ||
"repo": "String", | ||
"type": "String" | ||
}, | ||
"tests":[] | ||
} |
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,16 @@ | ||
--- This query is used by utilization dashboard | ||
-- TODO(): change to misc. once the pipeline is ready, currently fetch data from fortesting for development | ||
SELECT | ||
time_stamp AS ts, | ||
tags, | ||
json_data AS data | ||
FROM | ||
fortesting.oss_ci_time_series | ||
WHERE | ||
workflow_id = {workflowId: UInt64} | ||
AND run_attempt = {runAttempt: UInt32} | ||
AND job_id = {jobId: UInt64} | ||
AND repo = {repo: String } | ||
AND type = {type: String} | ||
ORDER BY | ||
ts |
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,28 @@ | ||
// TypeScript defaults error type to unknown, this file is to handle error messages and types | ||
|
||
type ErrorWithMessage = { | ||
message: string; | ||
}; | ||
|
||
function isErrorWithMessage(error: unknown): error is ErrorWithMessage { | ||
return ( | ||
typeof error === "object" && | ||
error !== null && | ||
"message" in error && | ||
typeof (error as Record<string, unknown>).message === "string" | ||
); | ||
} | ||
|
||
function toErrorWithMessage(candidate: unknown): ErrorWithMessage { | ||
if (isErrorWithMessage(candidate)) { | ||
return candidate; | ||
} | ||
try { | ||
return new Error(JSON.stringify(candidate)); | ||
} catch { | ||
return new Error(String(candidate)); | ||
} | ||
} | ||
export function getErrorMessage(error: unknown) { | ||
return toErrorWithMessage(error).message; | ||
} |
Oops, something went wrong.