Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3033)

Unified Diff: appengine/findit/handlers/handlers_util.py

Issue 2026283002: [Findit] Adding logic to force try jobs regardless of bailout or previous results (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: appengine/findit/handlers/handlers_util.py
diff --git a/appengine/findit/handlers/handlers_util.py b/appengine/findit/handlers/handlers_util.py
index ae6b95791dae2d523f3bf7991b022548de818fbd..2583e71943b8ca94879877992b9b4d0d06ad7f2a 100644
--- a/appengine/findit/handlers/handlers_util.py
+++ b/appengine/findit/handlers/handlers_util.py
@@ -192,9 +192,11 @@ def _OrganizeTryJobResultByCulprits(try_job_culprits):
return organized_culprits
-def _GetCulpritInfoForTryJobResultForTest(try_job_key, culprits_info):
+def _GetCulpritInfoForTryJobResultForTest(try_job_key, culprits_info,
+ show_debug_info):
referred_build_keys = try_job_key.split('/')
try_job = WfTryJob.Get(*referred_build_keys)
+
if not try_job or try_job.compile_results:
return
@@ -203,9 +205,10 @@ def _GetCulpritInfoForTryJobResultForTest(try_job_key, culprits_info):
for step_try_jobs in culprits_info.values():
# If try job found different culprits for each test, split tests by culprit.
additional_tests_culprit_info = []
+
for try_job_info in step_try_jobs['try_jobs']:
if (try_job_key != try_job_info['try_job_key']
- or try_job_info.get('status')):
+ or (try_job_info.get('status') and not show_debug_info)):
# Conditions that try_job_info has status are:
# If there is no swarming task, there won't be try job;
# If the swarming task is not completed yet, there won't be try job yet;
@@ -279,7 +282,8 @@ def _GetCulpritInfoForTryJobResultForTest(try_job_key, culprits_info):
step_try_jobs['try_jobs'].extend(additional_tests_culprit_info)
-def _UpdateTryJobInfoBasedOnSwarming(step_tasks_info, try_jobs):
+def _UpdateTryJobInfoBasedOnSwarming(step_tasks_info, try_jobs,
+ show_debug_info=False):
"""
Args:
step_tasks_info (dict): A dict of swarming task info for this step.
@@ -300,15 +304,17 @@ def _UpdateTryJobInfoBasedOnSwarming(step_tasks_info, try_jobs):
try_job_key = try_job['try_job_key']
task = step_tasks_info.get('swarming_tasks', {}).get(try_job_key)
- if task['task_info']['status'] != analysis_status.COMPLETED:
+ if (task['task_info']['status'] != analysis_status.COMPLETED and
+ not show_debug_info):
# There is someting wrong with swarming task or it's not done yet,
# no try job yet or ever.
try_job['status'] = result_status.NO_TRY_JOB_REASON_MAP[
task['task_info']['status']]
try_job['tests'] = task.get('all_tests', [])
else:
- # Swarming task is completed, group tests according to task result.
- try_job['ref_name'] = task['ref_name']
+ # Swarming task is completed or a manual try job rerun was triggered.
+ # Group tests according to task result.
+ try_job['ref_name'] = task.get('ref_name')
if task.get('reliable_tests'):
try_job['tests'] = task['reliable_tests']
if task.get('flaky_tests'):
@@ -331,7 +337,8 @@ def _UpdateTryJobInfoBasedOnSwarming(step_tasks_info, try_jobs):
try_jobs.extend(additional_flakiness_list)
-def _GetAllTryJobResultsForTest(failure_result_map, tasks_info):
+def _GetAllTryJobResultsForTest(failure_result_map, tasks_info,
+ show_debug_info=False):
culprits_info = defaultdict(lambda: defaultdict(list))
if not tasks_info:
return culprits_info
@@ -358,10 +365,16 @@ def _GetAllTryJobResultsForTest(failure_result_map, tasks_info):
}
try_jobs.append(try_job_dict)
- _UpdateTryJobInfoBasedOnSwarming(tasks_info[step_name], try_jobs)
+ if show_debug_info:
+ # Include any forced try jobs trigered manually in debug mode.
+ try_job_keys.add(step_failure_result_map)
+
+ _UpdateTryJobInfoBasedOnSwarming(tasks_info[step_name], try_jobs,
+ show_debug_info)
for try_job_key in try_job_keys:
- _GetCulpritInfoForTryJobResultForTest(try_job_key, culprits_info)
+ _GetCulpritInfoForTryJobResultForTest(try_job_key, culprits_info,
+ show_debug_info)
return culprits_info
@@ -395,7 +408,8 @@ def _GetTryJobResultForCompile(failure_result_map):
return culprit_info
-def GetAllTryJobResults(master_name, builder_name, build_number):
+def GetAllTryJobResults(master_name, builder_name, build_number,
+ show_debug_info=False):
culprits_info = {}
is_test_failure = True
@@ -410,7 +424,7 @@ def GetAllTryJobResults(master_name, builder_name, build_number):
if is_test_failure:
tasks_info = _GenerateSwarmingTasksData(failure_result_map)
culprits_info = _GetAllTryJobResultsForTest(
- failure_result_map, tasks_info)
+ failure_result_map, tasks_info, show_debug_info)
else:
culprits_info = _GetTryJobResultForCompile(failure_result_map)
elif analysis_result:

Powered by Google App Engine
This is Rietveld 408576698