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

Side by Side Diff: appengine/findit/findit_api.py

Issue 2382103005: [Findit] Check for availability of try-job result. (Closed)
Patch Set: Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """This module is to provide Findit service APIs through Cloud Endpoints: 5 """This module is to provide Findit service APIs through Cloud Endpoints:
6 6
7 Current APIs include: 7 Current APIs include:
8 1. Analysis of compile/test failures in Chromium waterfalls. 8 1. Analysis of compile/test failures in Chromium waterfalls.
9 Analyzes failures and detects suspected CLs. 9 Analyzes failures and detects suspected CLs.
10 """ 10 """
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 try_job_key = try_job_map.get(step_name, {}).get(test_name) 129 try_job_key = try_job_map.get(step_name, {}).get(test_name)
130 130
131 if not try_job_key: 131 if not try_job_key:
132 return None 132 return None
133 133
134 try_job = WfTryJob.Get(*try_job_key.split('/')) 134 try_job = WfTryJob.Get(*try_job_key.split('/'))
135 if not try_job or not try_job.completed or try_job.failed: 135 if not try_job or not try_job.completed or try_job.failed:
136 return None 136 return None
137 137
138 if build_failure_type == failure_type.COMPILE: 138 if build_failure_type == failure_type.COMPILE:
139 if not try_job.compile_results: # pragma: no cover.
140 return None
139 return try_job.compile_results[-1].get('culprit', {}).get(step_name) 141 return try_job.compile_results[-1].get('culprit', {}).get(step_name)
140 142
143 if not try_job.test_results: # pragma: no cover.
144 return None
145
141 if test_name is None: 146 if test_name is None:
142 step_info = try_job.test_results[-1].get('culprit', {}).get(step_name) 147 step_info = try_job.test_results[-1].get('culprit', {}).get(step_name)
143 if not step_info or step_info.get('tests'): # pragma: no cover. 148 if not step_info or step_info.get('tests'): # pragma: no cover.
144 # TODO(chanli): For some steps like checkperms/sizes/etc, the culprit 149 # TODO(chanli): For some steps like checkperms/sizes/etc, the culprit
145 # finding try-job might have test-level results. 150 # finding try-job might have test-level results.
146 return None 151 return None
147 return step_info 152 return step_info
148 153
149 task = WfSwarmingTask.Get(*try_job_key.split('/'), step_name=step_name) 154 task = WfSwarmingTask.Get(*try_job_key.split('/'), step_name=step_name)
150 ref_name = (task.parameters.get('ref_name') if task and task.parameters 155 ref_name = (task.parameters.get('ref_name') if task and task.parameters
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 logging.info('%d build failure(s), while %d are supported', 243 logging.info('%d build failure(s), while %d are supported',
239 len(request.builds), len(supported_builds)) 244 len(request.builds), len(supported_builds))
240 try: 245 try:
241 _TriggerNewAnalysesOnDemand(supported_builds) 246 _TriggerNewAnalysesOnDemand(supported_builds)
242 except Exception: # pragma: no cover. 247 except Exception: # pragma: no cover.
243 # If we fail to post a task to the task queue, we ignore and wait for next 248 # If we fail to post a task to the task queue, we ignore and wait for next
244 # request. 249 # request.
245 logging.exception('Failed to trigger new analyses on demand.') 250 logging.exception('Failed to trigger new analyses on demand.')
246 251
247 return _BuildFailureAnalysisResultCollection(results=results) 252 return _BuildFailureAnalysisResultCollection(results=results)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698