Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 import logging | 6 import logging |
| 7 | 7 |
| 8 from google.appengine.ext import ndb | 8 from google.appengine.ext import ndb |
| 9 | 9 |
| 10 from common import appengine_util | 10 from common import appengine_util |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 137 if not failed_steps: | 137 if not failed_steps: |
| 138 return failed_steps_and_tests | 138 return failed_steps_and_tests |
| 139 | 139 |
| 140 for step_name, step in failed_steps.iteritems(): | 140 for step_name, step in failed_steps.iteritems(): |
| 141 for test_name in step.get('tests', [None]): | 141 for test_name in step.get('tests', [None]): |
| 142 failed_steps_and_tests.append([step_name, test_name]) | 142 failed_steps_and_tests.append([step_name, test_name]) |
| 143 | 143 |
| 144 return sorted(failed_steps_and_tests) | 144 return sorted(failed_steps_and_tests) |
| 145 | 145 |
| 146 | 146 |
| 147 def _ChopOffPlatformFromStepName(step_name): | |
|
lijeffrey
2016/08/10 18:48:08
nit: rename this function '_RemovePlatformFromStep
josiahk
2016/08/10 21:22:34
Done.
| |
| 148 """Returns chopped off version of step name. | |
| 149 | |
| 150 Args: | |
| 151 step_name: Raw step name. Example: "net_unittests on Windows-10" | |
|
lijeffrey
2016/08/10 18:48:08
single quotes for strings
josiahk
2016/08/10 21:22:34
Done.
| |
| 152 | |
| 153 Returns: | |
| 154 Step name without platform. Example: "net_unittests on " | |
| 155 """ | |
| 156 if ' on ' in step_name: | |
| 157 return step_name[:step_name.find(' on ') + 4] | |
|
lijeffrey
2016/08/10 18:48:08
4? what's this magic number and why is it being us
josiahk
2016/08/10 21:22:35
Fixed!
| |
| 158 return step_name | |
| 159 | |
| 160 | |
| 147 def GetSuspectedCLsWithFailures(heuristic_result): | 161 def GetSuspectedCLsWithFailures(heuristic_result): |
| 148 """Generates a list of suspected CLs with failures. | 162 """Generates a list of suspected CLs with failures. |
| 149 | 163 |
| 150 Args: | 164 Args: |
| 151 heuristic_result: the heuristic_result from which to generate the list of | 165 heuristic_result: the heuristic_result from which to generate the list of |
| 152 suspected CLs with failures. | 166 suspected CLs with failures. |
| 153 | 167 |
| 154 Returns: | 168 Returns: |
| 155 A list of suspected CLs with failures that each could look like: | 169 A list of suspected CLs with failures that each could look like: |
| 156 | 170 |
| 157 [step_name, revision, test_name] | 171 [step_name, revision, test_name] |
| 158 | 172 |
| 159 or could look like: | 173 or could look like: |
| 160 | 174 |
| 161 [step_name, revision, None] | 175 [step_name, revision, None] |
| 162 """ | 176 """ |
| 163 suspected_cls_with_failures = [] | 177 suspected_cls_with_failures = [] |
| 164 | 178 |
| 165 if not heuristic_result: | 179 if not heuristic_result: |
| 166 return suspected_cls_with_failures | 180 return suspected_cls_with_failures |
| 167 | 181 |
| 168 # Iterates through the failures, tests, and suspected_cls, appending suspected | 182 # Iterates through the failures, tests, and suspected_cls, appending suspected |
| 169 # CLs and failures to the list. | 183 # CLs and failures to the list. |
| 170 for failure in heuristic_result['failures']: | 184 for failure in heuristic_result['failures']: |
| 171 if failure.get('tests'): | 185 if failure.get('tests'): |
| 172 for test in failure['tests']: | 186 for test in failure['tests']: |
| 173 for suspected_cl in test.get('suspected_cls', []): | 187 for suspected_cl in test.get('suspected_cls', []): |
| 174 suspected_cls_with_failures.append([ | 188 suspected_cls_with_failures.append([ |
| 175 failure['step_name'], | 189 _ChopOffPlatformFromStepName(failure['step_name']), |
| 176 suspected_cl['revision'], | 190 suspected_cl['revision'], |
| 177 test['test_name']]) | 191 test['test_name']]) |
| 178 else: | 192 else: |
| 179 for suspected_cl in failure['suspected_cls']: | 193 for suspected_cl in failure['suspected_cls']: |
| 180 suspected_cls_with_failures.append([ | 194 suspected_cls_with_failures.append([ |
| 181 failure['step_name'], | 195 _ChopOffPlatformFromStepName(failure['step_name']), |
| 182 suspected_cl['revision'], | 196 suspected_cl['revision'], |
| 183 None]) | 197 None]) |
| 184 | 198 |
| 185 return suspected_cls_with_failures | 199 return suspected_cls_with_failures |
| 186 | 200 |
| 187 | 201 |
| 188 def _LinkAnalysisToBuildFailureGroup( | 202 def _LinkAnalysisToBuildFailureGroup( |
| 189 master_name, builder_name, build_number, failure_group_key): | 203 master_name, builder_name, build_number, failure_group_key): |
| 190 analysis = WfAnalysis.Get(master_name, builder_name, build_number) | 204 analysis = WfAnalysis.Get(master_name, builder_name, build_number) |
| 191 analysis.failure_group_key = failure_group_key | 205 analysis.failure_group_key = failure_group_key |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 311 need_new_try_job, last_pass = _CheckFailureForTryJobKey( | 325 need_new_try_job, last_pass = _CheckFailureForTryJobKey( |
| 312 master_name, builder_name, build_number, | 326 master_name, builder_name, build_number, |
| 313 failure_result_map, TryJobType.COMPILE, failed_steps['compile']) | 327 failure_result_map, TryJobType.COMPILE, failed_steps['compile']) |
| 314 else: | 328 else: |
| 315 try_job_type = TryJobType.TEST | 329 try_job_type = TryJobType.TEST |
| 316 targeted_tests, need_new_try_job, last_pass = ( | 330 targeted_tests, need_new_try_job, last_pass = ( |
| 317 _CheckIfNeedNewTryJobForTestFailure( | 331 _CheckIfNeedNewTryJobForTestFailure( |
| 318 'step', master_name, builder_name, build_number, failure_result_map, | 332 'step', master_name, builder_name, build_number, failure_result_map, |
| 319 failed_steps)) | 333 failed_steps)) |
| 320 | 334 |
| 321 | |
| 322 need_new_try_job = ( | 335 need_new_try_job = ( |
| 323 need_new_try_job and ReviveOrCreateTryJobEntity( | 336 need_new_try_job and ReviveOrCreateTryJobEntity( |
| 324 master_name, builder_name, build_number, force_try_job)) | 337 master_name, builder_name, build_number, force_try_job)) |
| 325 | 338 |
| 326 # TODO(josiahk): Integrate _IsBuildFailureUniqueAcrossPlatforms() into | 339 # TODO(josiahk): Integrate _IsBuildFailureUniqueAcrossPlatforms() into |
| 327 # need_new_try_job boolean | 340 # need_new_try_job boolean |
| 328 if need_new_try_job: | 341 if need_new_try_job: |
| 329 _IsBuildFailureUniqueAcrossPlatforms( | 342 _IsBuildFailureUniqueAcrossPlatforms( |
| 330 master_name, builder_name, build_number, build_failure_type, | 343 master_name, builder_name, build_number, build_failure_type, |
| 331 builds[str(build_number)]['blame_list'], failed_steps, signals, | 344 builds[str(build_number)]['blame_list'], failed_steps, signals, |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 434 pipeline.pipeline_status_path, try_job_type) | 447 pipeline.pipeline_status_path, try_job_type) |
| 435 else: # pragma: no cover | 448 else: # pragma: no cover |
| 436 logging_str = ( | 449 logging_str = ( |
| 437 'Try job was scheduled for build %s, %s, %s: %s because of %s ' | 450 'Try job was scheduled for build %s, %s, %s: %s because of %s ' |
| 438 'failure.') % ( | 451 'failure.') % ( |
| 439 master_name, builder_name, build_number, | 452 master_name, builder_name, build_number, |
| 440 pipeline.pipeline_status_path, try_job_type) | 453 pipeline.pipeline_status_path, try_job_type) |
| 441 logging.info(logging_str) | 454 logging.info(logging_str) |
| 442 | 455 |
| 443 return failure_result_map | 456 return failure_result_map |
| OLD | NEW |