Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add option to show metrics for other repos #5962

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions torchci/clickhouse_queries/correlation_matrix/params.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"workflowNames": "String"
}
"workflowNames": "String",
"repo": "String"
}
2 changes: 1 addition & 1 deletion torchci/clickhouse_queries/correlation_matrix/query.sql
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ WHERE
AND workflow.event != 'workflow_run'
AND push.ref = 'refs/heads/master'
AND push.repository.owner.name = 'pytorch'
AND push.repository.name = 'pytorch'
AND push.repository.name = {repo: String}
AND job.name LIKE '%test%'
AND job.name NOT LIKE '%filter%'
AND job.name NOT LIKE '%rerun_disabled_tests%'
Expand Down
9 changes: 9 additions & 0 deletions torchci/clickhouse_queries/cost_job_generic/params.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"granularity": "String",
"startTime": "DateTime64(9)",
"stopTime": "DateTime64(9)",
"selectedRepos": "Array(String)",
"selectedGPU": "Array(UInt8)",
"selectedPlatforms": "Array(String)",
"selectedProviders": "Array(String)"
}
22 changes: 22 additions & 0 deletions torchci/clickhouse_queries/cost_job_generic/query.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
select
DATE_TRUNC(
{granularity: String},
rc.date
) as granularity_bucket,
rc.<DIMENSION> as <DIMENSION_NAME>,
sum(rc.<SELECTOR>) as total_<SELECTOR>
from
misc.runner_cost rc final
where
rc.date > {startTime: DateTime64(9)}
and rc.date < {stopTime: DateTime64(9)}
and rc.cost > 0
and rc.group_repo in {selectedRepos: Array(String)}
and rc.gpu in {selectedGPU: Array(UInt8)}
and rc.os in {selectedPlatforms: Array(String)}
and rc.provider in {selectedProviders: Array(String)}
group by
granularity_bucket,
job_name
order by
granularity_bucket asc
3 changes: 2 additions & 1 deletion torchci/clickhouse_queries/last_branch_push/params.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"branch": "String"
"branch": "String",
"repo": "String"
}
2 changes: 1 addition & 1 deletion torchci/clickhouse_queries/last_branch_push/query.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ from
where
push.ref = { branch : String }
AND push.repository.owner.name = 'pytorch'
AND push.repository.name = 'pytorch'
AND push.repository.name = {repo: String}
order by
push.head_commit.timestamp desc
limit
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"jobNames": "String"
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"workflowName": "String"
}
"workflowName": "String",
"repo": "String"
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ from
where
push.ref IN ('refs/heads/master', 'refs/heads/main')
AND push.repository.'owner'.'name' = 'pytorch'
AND push.repository.'name' = 'pytorch'
AND push.repository.'name' = {repo: String}
AND workflow.conclusion = 'success'
AND workflow.name = {workflowName: String}
order by
Expand Down
3 changes: 2 additions & 1 deletion torchci/clickhouse_queries/master_commit_red/params.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"startTime": "DateTime64(3)",
"stopTime": "DateTime64(3)",
"timezone": "String"
"timezone": "String",
"repo": "String"
}
2 changes: 1 addition & 1 deletion torchci/clickhouse_queries/master_commit_red/query.sql
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ WITH all_jobs AS (
'refs/heads/master', 'refs/heads/main'
)
AND push.repository.'owner'.'name' = 'pytorch'
AND push.repository.'name' = 'pytorch'
AND push.repository.'name' = {repo: String}
AND push.head_commit.'timestamp' >= {startTime: DateTime64(3)}
AND push.head_commit.'timestamp' < {stopTime: DateTime64(3)}
),
Expand Down
7 changes: 4 additions & 3 deletions torchci/clickhouse_queries/master_commit_red_avg/params.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"startTime": "DateTime64(3)",
"stopTime": "DateTime64(3)",
"workflowNames": "Array(String)"
"startTime": "DateTime64(3)",
"stopTime": "DateTime64(3)",
"workflowNames": "Array(String)",
"repo": "String"
}
2 changes: 1 addition & 1 deletion torchci/clickhouse_queries/master_commit_red_avg/query.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ with pushes as (
WHERE
push.ref IN ('refs/heads/master', 'refs/heads/main')
AND push.repository.'owner'.'name' = 'pytorch'
AND push.repository.'name' = 'pytorch'
AND push.repository.'name' = {repo: String}
AND push.head_commit.'timestamp' >= {startTime : DateTime64(3)}
AND push.head_commit.'timestamp' < {stopTime : DateTime64(3)}
), all_jobs AS (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"startTime": "DateTime64(3)",
"stopTime": "DateTime64(3)",
"workflowNames": "Array(String)"
"workflowNames": "Array(String)",
"repo": "String"
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ WITH all_jobs AS (
AND w.event != 'workflow_run' -- Filter out worflow_run-triggered jobs, which have nothing to do with the SHA
AND p.ref = 'refs/heads/main'
AND p.repository. 'owner'.'name' = 'pytorch'
AND p.repository. 'name' = 'pytorch'
AND p.repository. 'name' = {repo: String}
AND p.head_commit. 'timestamp' >= {startTime: DateTime64(3) }
AND p.head_commit. 'timestamp' < {stopTime: DateTime64(3) }
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"granularity": "String",
"startTime": "DateTime64(3)",
"stopTime": "DateTime64(3)",
"workflowNames": "Array(String)"
"workflowNames": "Array(String)",
"repo": "String"
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ WITH join_with_workflow_run AS (
AND w.event != 'workflow_run' -- Filter out worflow_run-triggered jobs, which have nothing to do with the SHA
AND p.ref = 'refs/heads/main'
AND p.repository. 'owner'.'name' = 'pytorch'
AND p.repository. 'name' = 'pytorch'
AND p.repository. 'name' = {repo: String}
AND p.head_commit. 'timestamp' >= {startTime: DateTime64(3) }
AND p.head_commit. 'timestamp' < {stopTime: DateTime64(3) }
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"granularity": "String",
"startTime": "DateTime64(3)",
"stopTime": "DateTime64(3)",
"workflowNames": "Array(String)"
"workflowNames": "Array(String)",
"repo": "String"
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ WITH all_jobs AS (
AND w.event != 'workflow_run' -- Filter out worflow_run-triggered jobs, which have nothing to do with the SHA
AND p.ref = 'refs/heads/main'
AND p.repository. 'owner'.'name' = 'pytorch'
AND p.repository. 'name' = 'pytorch'
AND p.repository. 'name' = {repo: String}
AND p.head_commit. 'timestamp' >= {startTime: DateTime64(3) }
AND p.head_commit. 'timestamp' < {stopTime: DateTime64(3) }
),
Expand Down
2 changes: 1 addition & 1 deletion torchci/clickhouse_queries/num_reverts/query.sql
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ weekly_results AS (
WHERE
push.ref IN ('refs/heads/master', 'refs/heads/main')
AND push.repository.owner.login = 'pytorch'
AND push.repository.name = 'pytorch'
AND push.repository.name = {repo: String}
AND (
push.head_commit.message LIKE 'Revert %'
OR push.head_commit.message LIKE 'Back out%'
Expand Down
5 changes: 3 additions & 2 deletions torchci/clickhouse_queries/reverts/params.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"startTime": "DateTime64(3)",
"stopTime": "DateTime64(3)"
"startTime": "DateTime64(3)",
"stopTime": "DateTime64(3)",
"repo": "String"
}
2 changes: 1 addition & 1 deletion torchci/clickhouse_queries/reverts/query.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ FROM
WHERE
push.ref IN ('refs/heads/master', 'refs/heads/main')
AND push.repository.owner.name = 'pytorch'
AND push.repository.name = 'pytorch'
AND push.repository.name = {repo: String}
AND (
push.head_commit.message LIKE 'Revert %'
OR push.head_commit.message LIKE 'Back out%'
Expand Down
3 changes: 2 additions & 1 deletion torchci/clickhouse_queries/ttrs_percentiles/params.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"percentile_to_get": "Float64",
"startTime": "DateTime64(3)",
"stopTime": "DateTime64(3)",
"workflow": "String"
"workflow": "String",
"repo": "String"
}
2 changes: 1 addition & 1 deletion torchci/clickhouse_queries/ttrs_percentiles/query.sql
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pr_shas AS (
and run_started_at < {stopTime: DateTime64(3)}
)
AND LENGTH(r.pull_requests) = 1
AND r.pull_requests[1].'head'.'repo'.'name' = 'pytorch'
AND r.pull_requests[1].'head'.'repo'.'name' = {repo: String}
AND r.name IN ('pull', 'trunk', 'Lint') -- Ensure we don't pull in random PRs we don't care about
AND r.head_branch NOT IN (
'master', 'main', 'nightly', 'viable/strict'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"merge_type": "String",
"one_bucket": "Bool",
"startTime": "DateTime64(3)",
"stopTime": "DateTime64(3)"
"stopTime": "DateTime64(3)",
"repo": "String"
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ all_merges AS (
INNER JOIN issue_comments c ON m.pr_num = c.pr_num
WHERE
m.owner = 'pytorch'
AND m.project = 'pytorch'
AND m.project = {repo: String}
AND m.merge_commit_sha != '' -- only consider successful merges
GROUP BY
m.skip_mandatory_checks,
Expand Down
32 changes: 26 additions & 6 deletions torchci/pages/metrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,8 @@ export default function Page() {
const [stopTime, setStopTime] = useState(dayjs());
const [timeRange, setTimeRange] = useState<number>(7);

const [repo, setRepo] = useState<string>("pytorch");

// TODO (huydhn): Clean this up once ClickHouse migration finishes
const { useCH: useClickHouse } = useCHContext();

Expand All @@ -500,7 +502,11 @@ export default function Page() {
value: stopTime,
},
];
const timeParamsClickHouse = RStoCHTimeParams(timeParams);

const timeParamsClickHouse = {
...RStoCHTimeParams(timeParams),
repo: repo,
};

const [ttsPercentile, setTtsPercentile] = useState<number>(0.5);

Expand Down Expand Up @@ -565,6 +571,18 @@ export default function Page() {
ttsPercentile={ttsPercentile}
setTtsPercentile={setTtsPercentile}
/>
<FormControl>
<InputLabel id="repo-select-label">Repo</InputLabel>
<Select
value={repo}
label="Repo"
labelId="repo-select-label"
onChange={(e) => setRepo(e.target.value as string)}
>
<MenuItem value={"pytorch"}>PyTorch</MenuItem>
<MenuItem value={"executorch"}>Executorch</MenuItem>
</Select>
</FormControl>
</Stack>

<Grid container spacing={2}>
Expand Down Expand Up @@ -688,6 +706,7 @@ export default function Page() {
one_bucket: true,
percentile_to_get: 0.9,
workflow: "pull",
repo: repo,
}
: [
{
Expand Down Expand Up @@ -754,7 +773,7 @@ export default function Page() {
queryParams={
useClickHouse
? {
repo: "pytorch",
repo: repo,
owner: "pytorch", // Not a parameter for the rockset query
head: "refs/heads/main",
}
Expand Down Expand Up @@ -789,7 +808,7 @@ export default function Page() {
valueRenderer={(value) => durationDisplay(value)}
queryParams={
useClickHouse
? { branch: "refs/heads/main" }
? { branch: "refs/heads/main", repo: repo }
: [
{
name: "branch",
Expand All @@ -808,7 +827,7 @@ export default function Page() {
valueRenderer={(value) => durationDisplay(value)}
queryParams={
useClickHouse
? { branch: "refs/heads/nightly" }
? { branch: "refs/heads/nightly", repo: repo }
: [
{
name: "branch",
Expand Down Expand Up @@ -839,6 +858,7 @@ export default function Page() {
useClickHouse
? {
workflowName: "docker-builds",
repo: repo,
}
: [
{
Expand Down Expand Up @@ -1010,7 +1030,7 @@ export default function Page() {
queryName={"workflow_load"}
queryParams={
useClickHouse
? { ...timeParamsClickHouse, repo: "pytorch/pytorch" }
? { ...timeParamsClickHouse, repo: `pytorch/${repo}` }
: [
{
name: "timezone",
Expand Down Expand Up @@ -1112,7 +1132,7 @@ export default function Page() {
queryName={"disabled_test_historical"}
queryParams={
useClickHouse
? { ...timeParamsClickHouse, repo: "pytorch/pytorch" }
? { ...timeParamsClickHouse, repo: `pytorch/${repo}` }
: [
{
name: "timezone",
Expand Down