Skip to content

Commit 969e391

Browse files
authored
Tweak queries for LPID for fine tuning (#8940)
1 parent 9e6ecab commit 969e391

File tree

1 file changed

+22
-17
lines changed

1 file changed

+22
-17
lines changed

treeherder/log_parser/intermittents.py

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,27 @@ def _check_and_mark_infra(current_job, job_ids, push_ids):
1717
# look for all jobs in pushids matching current_job.job_type.name
1818
# if older are failing for "infra", then ensure same job is passing
1919
# if so mark as intermittent
20-
extra_jobs = Job.objects.filter(
21-
push__id__range=(push_ids[-1], push_ids[0]),
22-
repository__id=current_job.repository.id,
23-
job_type__name=current_job.job_type.name,
24-
failure_classification_id__in=[1, 6, 8],
25-
job_log__status__in=[1, 3], # ignore pending, failed
26-
state="completed", # ignore running/pending
27-
result__in=[
28-
"busted",
29-
"testfailed",
30-
"exception",
31-
"success",
32-
], # primarily ignore retry/usercancel
33-
).values(
34-
"id",
35-
"result",
36-
"failure_classification_id",
20+
extra_jobs = (
21+
Job.objects.filter(
22+
push__id__range=(push_ids[-1], push_ids[0]),
23+
repository__id=current_job.repository.id,
24+
job_type__name=current_job.job_type.name,
25+
failure_classification_id__in=[1, 6, 8],
26+
job_log__status__in=[1, 3], # ignore pending, failed
27+
state="completed", # ignore running/pending
28+
result__in=[
29+
"busted",
30+
"testfailed",
31+
"exception",
32+
"success",
33+
], # primarily ignore retry/usercancel
34+
)
35+
.values(
36+
"id",
37+
"result",
38+
"failure_classification_id",
39+
)
40+
.distinct("id")
3741
)
3842

3943
# ignore previous classified, we are looking for NEW extra jobs
@@ -116,6 +120,7 @@ def check_and_mark_intermittent(job_id):
116120
], # primarily ignore retry/usercancel/unknown
117121
group_result__status__in=[GroupStatus.OK, GroupStatus.ERROR],
118122
)
123+
.exclude(name__exact="")
119124
.values(
120125
"name",
121126
"job_logs__job__id",

0 commit comments

Comments
 (0)