Skip to content

Commit a9b4e21

Browse files
authored
Filter out restarted jobs from CH queries (#6954)
As the prerequisite for running autorevert in shadow mode, we need to filter out restarted jobs from the existing queries where they might skew the results.
1 parent 33f2ad0 commit a9b4e21

File tree

5 files changed

+6
-0
lines changed

5 files changed

+6
-0
lines changed

aws/lambda/pytorch-auto-revert/pytorch_auto_revert/autorevert_checker.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ def _fetch_workflow_data(self):
116116
AND head_branch = 'main'
117117
AND created_at >= {lookback_time:DateTime}
118118
AND dynamoKey LIKE 'pytorch/pytorch/%'
119+
AND workflow_event != 'workflow_dispatch' -- Exclude restart jobs
119120
ORDER BY
120121
workflow_name, workflow_created_at DESC, head_sha, name
121122
"""

torchci/clickhouse_queries/commit_jobs_batch_query/query.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ WITH job AS (
3030
AND job.name != 'generate-test-matrix'
3131
AND workflow.event != 'workflow_run' -- Filter out workflow_run-triggered jobs, which have nothing to do with the SHA
3232
AND workflow.event != 'repository_dispatch' -- Filter out repository_dispatch-triggered jobs, which have nothing to do with the SHA
33+
AND NOT (workflow.event = 'workflow_dispatch' AND workflow.head_branch LIKE 'trunk/%') -- Filter out restart jobs
3334
and job.id in (select id from materialized_views.workflow_job_by_head_sha where head_sha in {shas: Array(String)})
3435
and workflow.id in (select id from materialized_views.workflow_run_by_head_sha where head_sha in {shas: Array(String)})
3536
),

torchci/clickhouse_queries/commit_jobs_query/query.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ WITH job AS (
4545
AND job.name != 'generate-test-matrix'
4646
AND workflow.event != 'workflow_run' -- Filter out workflow_run-triggered jobs, which have nothing to do with the SHA
4747
AND workflow.event != 'repository_dispatch' -- Filter out repository_dispatch-triggered jobs, which have nothing to do with the SHA
48+
AND NOT (workflow.event = 'workflow_dispatch' AND workflow.head_branch LIKE 'trunk/%') -- Filter out restart jobs
4849
AND workflow.id in (select id from materialized_views.workflow_run_by_head_sha where head_sha = {sha: String})
4950
AND (
5051
{workflowId: Int64} = 0
@@ -87,6 +88,7 @@ WITH job AS (
8788
WHERE
8889
workflow.event != 'workflow_run' -- Filter out workflow_run-triggered jobs, which have nothing to do with the SHA
8990
AND workflow.event != 'repository_dispatch' -- Filter out repository_dispatch-triggered jobs, which have nothing to do with the SHA
91+
AND NOT (workflow.event = 'workflow_dispatch' AND workflow.head_branch LIKE 'trunk/%') -- Filter out restart jobs
9092
AND workflow.id in (select id from materialized_views.workflow_run_by_head_sha where head_sha = {sha: String})
9193
AND (
9294
{workflowId: Int64} = 0

torchci/clickhouse_queries/flaky_tests/across_jobs/query.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ with failed_jobs as (
3737
and w.name in ('trunk', 'pull')
3838
and job.name not like '%mem_leak_check%'
3939
and job.name not like '%rerun_disabled_tests%'
40+
and w.event != 'workflow_dispatch' -- Filter out restart jobs
4041
order by
4142
job._event_time
4243
),

torchci/clickhouse_queries/hud_query/query.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ WITH job AS (
3232
) -- Should be filtered out by the workflow_event filters, but workflow_event takes some time to populate
3333
AND job.workflow_event != 'workflow_run' -- Filter out workflow_run-triggered jobs, which have nothing to do with the SHA
3434
AND job.workflow_event != 'repository_dispatch' -- Filter out repository_dispatch-triggered jobs, which have nothing to do with the SHA
35+
AND NOT (job.workflow_event = 'workflow_dispatch' AND job.head_branch LIKE 'trunk/%') -- Filter out restart jobs
3536
AND job.id in (select id from materialized_views.workflow_job_by_head_sha where head_sha in {shas: Array(String)})
3637
AND job.repository_full_name = {repo: String}
3738
AND job.workflow_name != 'Upload test stats while running' -- Continuously running cron job that cancels itself to avoid running concurrently

0 commit comments

Comments
 (0)