-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CH] Migrate failure annotation page (#5803)
This is more like a refactoring, not a migration, but it's needed to make the query works. * `failed_workflow_jobs` runs OOM on ClickHouse trying to load all failed jobs from commits that are having more than N failures. I rewrite the logic to get rid of N because we only set it to 0 anyway. The simplified logic can be then be run * https://hud.pytorch.org/failedjobs/pytorch/pytorch/main has duplicated entries. This is a subtle bug from `torchci/components/JobAnnotationToggle.tsx` that took me way too long to figure out. * There are several React warnings on the page, so I fix them too ### Testing https://torchci-git-fork-huydhn-ch-migrate-job-anno-45acb4-fbopensource.vercel.app/failedjobs/pytorch/pytorch/main
- Loading branch information
Showing
5 changed files
with
54 additions
and
114 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
{ | ||
"branch": "String", | ||
"count": "Int64", | ||
"repo": "String", | ||
"startTime": "DateTime64(3)", | ||
"stopTime": "DateTime64(3)" | ||
} | ||
} |
82 changes: 24 additions & 58 deletions
82
torchci/clickhouse_queries/failed_workflow_jobs/query.sql
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 |
---|---|---|
@@ -1,60 +1,26 @@ | ||
-- !!! Query is not converted to CH syntax yet. Delete this line when it gets converted | ||
WITH repeats AS ( | ||
SELECT | ||
array_agg(j.id) AS ids | ||
FROM | ||
workflow_run w | ||
JOIN workflow_job j ON w.id = j.run_id HINT(join_strategy = lookup) | ||
WHERE | ||
j._event_time >= PARSE_DATETIME_ISO8601(: startTime) | ||
AND j._event_time < PARSE_DATETIME_ISO8601(: stopTime) | ||
AND w.head_repository.full_name = : repo | ||
AND w.head_branch = : branch | ||
AND w.event != 'workflow_run' | ||
AND w.event != 'repository_dispatch' | ||
GROUP BY | ||
j.head_sha, | ||
j.name, | ||
w.name | ||
HAVING | ||
count(*) > : count | ||
AND bool_or( | ||
j.conclusion IN ( | ||
'failure', 'cancelled', 'time_out' | ||
) | ||
) | ||
), | ||
ids AS ( | ||
SELECT | ||
ids.id | ||
FROM | ||
repeats, | ||
UNNEST(repeats.ids AS id) AS ids | ||
) | ||
SELECT | ||
job.head_sha AS sha, | ||
CONCAT(w.name, ' / ', job.name) AS jobName, | ||
job.id, | ||
job.conclusion, | ||
job.html_url AS htmlUrl, | ||
CONCAT( | ||
'https://ossci-raw-job-status.s3.amazonaws.com/log/', | ||
CAST(job.id AS string) | ||
) AS logUrl, | ||
DATE_DIFF( | ||
'SECOND', | ||
PARSE_TIMESTAMP_ISO8601(job.started_at), | ||
PARSE_TIMESTAMP_ISO8601(job.completed_at) | ||
) AS durationS, | ||
w.repository.full_name AS repo, | ||
ARRAY_CREATE(job.torchci_classification.line) AS failureLines, | ||
job.torchci_classification.captures AS failureCaptures, | ||
ARRAY_CREATE(job.torchci_classification.line_num) AS failureLineNumbers, | ||
-- This query is used to annotate job on HUD | ||
SELECT DISTINCT | ||
j.head_sha AS sha, | ||
CONCAT(w.name, ' / ', j.name) AS jobName, | ||
j.id, | ||
j.conclusion, | ||
j.html_url AS htmlUrl, | ||
CONCAT( | ||
'https://ossci-raw-job-status.s3.amazonaws.com/log/', | ||
j.id | ||
) AS logUrl, | ||
DATE_DIFF('SECOND', j.started_at, j.completed_at) AS durationS, | ||
array(j.torchci_classification. 'line') AS failureLines, | ||
j.torchci_classification. 'captures' AS failureCaptures, | ||
array(j.torchci_classification. 'line_num') AS failureLineNumbers | ||
FROM | ||
ids | ||
JOIN workflow_job job on job.id = ids.id | ||
INNER JOIN workflow_run w on w.id = job.run_id | ||
workflow_job j FINAL | ||
JOIN workflow_run w FINAL on w.id = j.run_id | ||
WHERE | ||
job.conclusion IN ( | ||
'failure', 'cancelled', 'time_out' | ||
) | ||
j.created_at >= {startTime: DateTime64(3) } | ||
AND j.created_at < {stopTime: DateTime64(3) } | ||
AND w.head_repository. 'full_name' = {repo: String } | ||
AND w.head_branch = {branch: String } | ||
AND w.event != 'workflow_run' | ||
AND w.event != 'repository_dispatch' | ||
AND j.conclusion IN ('failure', 'cancelled', 'time_out') |
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
20 changes: 5 additions & 15 deletions
20
torchci/pages/api/job_annotation/[repoOwner]/[repoName]/failures/[queryParams].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