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

Side by Side Diff: appengine/findit/waterfall/try_job_util.py

Issue 2232613002: Chop off platform name from step name (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Remove ' on ', simplification, and code review changes Created 4 years, 4 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 | « appengine/findit/waterfall/test/try_job_util_test.py ('k') | 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 from datetime import datetime 5 from datetime import datetime
6 from datetime import timedelta 6 from datetime import timedelta
7 import logging 7 import logging
8 8
9 from google.appengine.ext import ndb 9 from google.appengine.ext import ndb
10 10
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 if not failed_steps: 141 if not failed_steps:
142 return failed_steps_and_tests 142 return failed_steps_and_tests
143 143
144 for step_name, step in failed_steps.iteritems(): 144 for step_name, step in failed_steps.iteritems():
145 for test_name in step.get('tests', [None]): 145 for test_name in step.get('tests', [None]):
146 failed_steps_and_tests.append([step_name, test_name]) 146 failed_steps_and_tests.append([step_name, test_name])
147 147
148 return sorted(failed_steps_and_tests) 148 return sorted(failed_steps_and_tests)
149 149
150 150
151 def _RemovePlatformFromStepName(step_name):
152 """Returns step name without platform.
153
154 Args:
155 step_name: Raw step name. Example: 'net_unittests on Windows-10'.
156
157 Returns:
158 Step name without platform or the string ' on '. Example: 'net_unittests'.
159 """
160 separator = ' on '
161 return step_name.split(separator)[0]
lijeffrey 2016/08/10 23:24:25 I believe step_name should always be 1 word, so yo
chanli 2016/08/11 20:47:06 The changes here and in handler_util are all tempo
162
163
151 def GetSuspectedCLsWithFailures(heuristic_result): 164 def GetSuspectedCLsWithFailures(heuristic_result):
152 """Generates a list of suspected CLs with failures. 165 """Generates a list of suspected CLs with failures.
153 166
154 Args: 167 Args:
155 heuristic_result: the heuristic_result from which to generate the list of 168 heuristic_result: the heuristic_result from which to generate the list of
156 suspected CLs with failures. 169 suspected CLs with failures.
157 170
158 Returns: 171 Returns:
159 A list of suspected CLs with failures that each could look like: 172 A list of suspected CLs with failures that each could look like:
160 173
161 [step_name, revision, test_name] 174 [step_name, revision, test_name]
162 175
163 or could look like: 176 or could look like:
164 177
165 [step_name, revision, None] 178 [step_name, revision, None]
166 """ 179 """
167 suspected_cls_with_failures = [] 180 suspected_cls_with_failures = []
168 181
169 if not heuristic_result: 182 if not heuristic_result:
170 return suspected_cls_with_failures 183 return suspected_cls_with_failures
171 184
172 # Iterates through the failures, tests, and suspected_cls, appending suspected 185 # Iterates through the failures, tests, and suspected_cls, appending suspected
173 # CLs and failures to the list. 186 # CLs and failures to the list.
174 for failure in heuristic_result['failures']: 187 for failure in heuristic_result['failures']:
175 if failure.get('tests'): 188 if failure.get('tests'):
176 for test in failure['tests']: 189 for test in failure['tests']:
177 for suspected_cl in test.get('suspected_cls', []): 190 for suspected_cl in test.get('suspected_cls', []):
178 suspected_cls_with_failures.append([ 191 suspected_cls_with_failures.append([
179 failure['step_name'], 192 _RemovePlatformFromStepName(failure['step_name']),
180 suspected_cl['revision'], 193 suspected_cl['revision'],
181 test['test_name']]) 194 test['test_name']])
182 else: 195 else:
183 for suspected_cl in failure['suspected_cls']: 196 for suspected_cl in failure['suspected_cls']:
184 suspected_cls_with_failures.append([ 197 suspected_cls_with_failures.append([
185 failure['step_name'], 198 _RemovePlatformFromStepName(failure['step_name']),
186 suspected_cl['revision'], 199 suspected_cl['revision'],
187 None]) 200 None])
188 201
189 return suspected_cls_with_failures 202 return suspected_cls_with_failures
190 203
191 204
192 def _LinkAnalysisToBuildFailureGroup( 205 def _LinkAnalysisToBuildFailureGroup(
193 master_name, builder_name, build_number, failure_group_key): 206 master_name, builder_name, build_number, failure_group_key):
194 analysis = WfAnalysis.Get(master_name, builder_name, build_number) 207 analysis = WfAnalysis.Get(master_name, builder_name, build_number)
195 analysis.failure_group_key = failure_group_key 208 analysis.failure_group_key = failure_group_key
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 pipeline.pipeline_status_path, try_job_type) 460 pipeline.pipeline_status_path, try_job_type)
448 else: # pragma: no cover 461 else: # pragma: no cover
449 logging_str = ( 462 logging_str = (
450 'Try job was scheduled for build %s, %s, %s: %s because of %s ' 463 'Try job was scheduled for build %s, %s, %s: %s because of %s '
451 'failure.') % ( 464 'failure.') % (
452 master_name, builder_name, build_number, 465 master_name, builder_name, build_number,
453 pipeline.pipeline_status_path, try_job_type) 466 pipeline.pipeline_status_path, try_job_type)
454 logging.info(logging_str) 467 logging.info(logging_str)
455 468
456 return failure_result_map 469 return failure_result_map
OLDNEW
« no previous file with comments | « appengine/findit/waterfall/test/try_job_util_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698