Skip to content

Commit

Permalink
[HUD] add percentage for linux rollover (#5643)
Browse files Browse the repository at this point in the history
Co-authored-by: Zain Rizvi <[email protected]>
  • Loading branch information
PaliC and ZainRizvi authored Sep 12, 2024
1 parent 1a65b17 commit 0778313
Show file tree
Hide file tree
Showing 4 changed files with 144 additions and 1 deletion.
13 changes: 13 additions & 0 deletions torchci/pages/metrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1118,6 +1118,19 @@ export default function Page() {
groupByFieldName={"job_name"}
/>
</Grid>
<Grid item xs={6} height={ROW_HEIGHT}>
<TimeSeriesPanel
title={"Percentage of jobs rolled over to Linux Foundation"}
queryName={"lf_rollover_percentage"}
queryCollection={"metrics"}
queryParams={[]}
granularity={"hour"}
timeFieldName={"bucket"}
yAxisFieldName={"percentage"}
groupByFieldName={"fleet"}
yAxisRenderer={(value) => value.toFixed(2).toString() + "%"}
/>
</Grid>
</Grid>
</div>
);
Expand Down
113 changes: 113 additions & 0 deletions torchci/rockset/metrics/__sql/lf_rollover_percentage.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
WITH
normalized_jobs AS (
SELECT
if(
strpos(l.label, 'amz2023.') = 0,
l.label,
CONCAT(
substr(l.label, 1, strpos(l.label, 'amz2023.') - 1),
substr(
l.label,
length('amz2023.') + strpos(l.label, 'amz2023.')
)
)
) as label,
REGEXP_EXTRACT(j.name, '([^,]*),?', 1) as job_name,
-- remove shard number and label from job names
j.workflow_name,
DATE_TRUNC(
:granularity,
PARSE_TIMESTAMP_ISO8601(j.started_at)
) AS bucket,
FROM
commons.workflow_job j
CROSS JOIN UNNEST(j.labels as label) as l
WHERE
1 = 1
AND j.labels is not NULL
AND j._event_time > CURRENT_DATETIME() - DAYS(:days_ago)
AND j.status = 'completed'
AND l.label != 'self-hosted'
AND l.label not like 'lf.c.%'
AND l.label not like '%canary%'
),
migrated_jobs AS (
SELECT
DISTINCT j.job_name
FROM
normalized_jobs j
WHERE
1 = 1
AND j.label like 'lf%'
),
comparable_jobs AS (
SELECT
j.bucket,
j.label,
j.job_name,
-- remove shard number and label from job names
j.workflow_name,
FROM
normalized_jobs j
CROSS JOIN migrated_jobs mj
WHERE
1 = 1
AND j.job_name = mj.job_name -- AND STRPOS(j.name, mj.job_clean) > 0
),
success_stats AS (
SELECT
bucket,
count(*) as group_size,
job_name,
workflow_name,
label,
IF(SUBSTR(label, 1, 3) = 'lf.', True, False) as lf_fleet,
FROM
comparable_jobs
GROUP BY
bucket,
job_name,
workflow_name,
label
),
comparison_stats AS (
SELECT
lf.bucket,
SUM(lf.group_size + m.group_size) as total_jobs,
SUM(m.group_size) as compliment_jobs,
SUM(lf.group_size) as counted_jobs,
m.lf_fleet as c_fleet,
lf.lf_fleet as m_fleet,
CAST(SUM(lf.group_size) as FLOAT) / SUM(lf.group_size + m.group_size) * 100 as percentage,
IF(lf.lf_fleet, 'Linux Foundation', 'Meta') as fleet
FROM
success_stats lf
INNER JOIN success_stats m on lf.bucket = m.bucket
WHERE
1 = 1
AND lf.job_name = m.job_name
AND lf.workflow_name = m.workflow_name
AND (
(
lf.lf_fleet = True
AND m.lf_fleet = False
)
OR (
lf.lf_fleet = False
AND m.lf_fleet = True
)
)
AND lf.group_size > 3
AND m.group_size > 3
GROUP BY
lf.bucket,
lf.lf_fleet,
m.lf_fleet
)
SELECT
*
from
comparison_stats
ORDER BY
bucket DESC
-- ORDER by bucket desc, job_name desc, success_rate_delta, workflow_name
16 changes: 16 additions & 0 deletions torchci/rockset/metrics/lf_rollover_percentage.lambda.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"sql_path": "__sql/lf_rollover_percentage.sql",
"default_parameters": [
{
"name": "days_ago",
"type": "int",
"value": "14"
},
{
"name": "granularity",
"type": "string",
"value": "day"
}
],
"description": ""
}
3 changes: 2 additions & 1 deletion torchci/rockset/prodVersions.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@
"completed_pr_jobs_aggregate": "7b6b27eeca4dfc6f",
"get_workers_on_period": "ae5cf853350477c7",
"queue_times_historical_pct": "f815ad1732928bb6",
"lf_rollover_health": "b3eb4ffc761a224a"
"lf_rollover_health": "b3eb4ffc761a224a",
"lf_rollover_percentage": "423f2523aa1e85b2"
},
"inductor": {
"compilers_benchmark_performance": "442c41fbbc0eb758",
Expand Down

0 comments on commit 0778313

Please sign in to comment.