Skip to content

Commit 9e898ec

Browse files
committed
pw_contest: limit the number of updates on the first run
We seem to report 12 checks for the first branch that contains a patch, because the test case count grows slowly. This happens mostly for branches which have failures, as failure is declared as soon as one remote fails, even if others are pending. So limit the updates of test count for otherwise equivalent state if some remotes are still running. Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 20beb3d commit 9e898ec

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

pw_contest.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ def branch_summarize(filters: dict, results_by_branch: dict) -> dict:
124124
for name, branch in results_by_branch.items():
125125
code = 0
126126
test_cnt = 0
127+
pending = 0
127128
for remote in filters["remotes"]:
128129
new_code = Codes.PENDING
129130
if remote in branch:
@@ -132,7 +133,11 @@ def branch_summarize(filters: dict, results_by_branch: dict) -> dict:
132133
new_code = branch[remote]['code']
133134
test_cnt += branch[remote]["cnt"]
134135
code = max(code, new_code)
136+
if new_code == Codes.PENDING:
137+
pending += 1
135138
summary[name] = {'result': code_to_str[code], 'code': code, 'cnt': test_cnt}
139+
if pending:
140+
summary[name]['pending'] = pending
136141
return summary
137142

138143

@@ -153,7 +158,11 @@ def result_upgrades(states: dict, item_id: str, outcome: dict, branch: str):
153158
if prev['code'] > outcome['code']:
154159
return True
155160
if prev['code'] == outcome['code']:
156-
return prev['cnt'] < outcome['cnt']
161+
# use the run with most reported results, but wait for it to finish
162+
# otherwise first contest for a patch updates the check every time
163+
# a remote finishes and bumps the test case count (~12 updates)
164+
if prev['cnt'] < outcome['cnt']:
165+
return bool(outcome.get('pending'))
157166
return False
158167

159168

0 commit comments

Comments
 (0)