| 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 """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 2. Analysis of flakes on Commit Queue. | 10 2. Analysis of flakes on Commit Queue. |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 if not cl: | 166 if not cl: |
| 167 return None, None | 167 return None, None |
| 168 | 168 |
| 169 master_name = buildbot.GetMasterNameFromUrl(build.master_url) | 169 master_name = buildbot.GetMasterNameFromUrl(build.master_url) |
| 170 builder_name = build.builder_name | 170 builder_name = build.builder_name |
| 171 current_build = build.build_number | 171 current_build = build.build_number |
| 172 | 172 |
| 173 # If the CL is found by a try job, only the first failure will be recorded. | 173 # If the CL is found by a try job, only the first failure will be recorded. |
| 174 # So we might need to go to the first failure to get CL information. | 174 # So we might need to go to the first failure to get CL information. |
| 175 build_info = cl.GetBuildInfo(master_name, builder_name, current_build) | 175 build_info = cl.GetBuildInfo(master_name, builder_name, current_build) |
| 176 first_build_info = cl.GetBuildInfo( | 176 first_build_info = None if not reference_build_key else cl.GetBuildInfo( |
| 177 *build_util.GetBuildInfoFromId(reference_build_key)) | 177 *build_util.GetBuildInfoFromId(reference_build_key)) |
| 178 return suspected_cl_util.GetSuspectedCLConfidenceScoreAndApproach( | 178 return suspected_cl_util.GetSuspectedCLConfidenceScoreAndApproach( |
| 179 confidences, build_info, first_build_info) | 179 confidences, build_info, first_build_info) |
| 180 | 180 |
| 181 def _GenerateBuildFailureAnalysisResult( | 181 def _GenerateBuildFailureAnalysisResult( |
| 182 self, build, suspected_cls_in_result, step_name, first_failure, test_name, | 182 self, build, suspected_cls_in_result, step_name, first_failure, test_name, |
| 183 analysis_approach, confidences, try_job_status, is_flaky_test, | 183 analysis_approach, confidences, try_job_status, is_flaky_test, |
| 184 reference_build_key): | 184 reference_build_key): |
| 185 | 185 |
| 186 suspected_cls = [] | 186 suspected_cls = [] |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 | 402 |
| 403 for failure in heuristic_analysis.result['failures']: | 403 for failure in heuristic_analysis.result['failures']: |
| 404 step_name = failure['step_name'] | 404 step_name = failure['step_name'] |
| 405 if failure.get('tests'): # Test-level analysis. | 405 if failure.get('tests'): # Test-level analysis. |
| 406 for test in failure['tests']: | 406 for test in failure['tests']: |
| 407 test_name = test['test_name'] | 407 test_name = test['test_name'] |
| 408 reference_build_key, swarming_task, try_job = ( | 408 reference_build_key, swarming_task, try_job = ( |
| 409 self._GetSwarmingTaskAndTryJobForFailure( | 409 self._GetSwarmingTaskAndTryJobForFailure( |
| 410 step_name, test_name, heuristic_analysis.failure_result_map, | 410 step_name, test_name, heuristic_analysis.failure_result_map, |
| 411 swarming_tasks, try_jobs)) | 411 swarming_tasks, try_jobs)) |
| 412 | |
| 413 self._PopulateResult( | 412 self._PopulateResult( |
| 414 results, build, heuristic_analysis.failure_type, test, | 413 results, build, heuristic_analysis.failure_type, test, |
| 415 step_name, confidences, reference_build_key, swarming_task, | 414 step_name, confidences, reference_build_key, swarming_task, |
| 416 try_job, test_name=test_name) | 415 try_job, test_name=test_name) |
| 417 else: | 416 else: |
| 418 reference_build_key, swarming_task, try_job = ( | 417 reference_build_key, swarming_task, try_job = ( |
| 419 self._GetSwarmingTaskAndTryJobForFailure( | 418 self._GetSwarmingTaskAndTryJobForFailure( |
| 420 step_name, None, heuristic_analysis.failure_result_map, | 419 step_name, None, heuristic_analysis.failure_result_map, |
| 421 swarming_tasks, try_jobs)) | 420 swarming_tasks, try_jobs)) |
| 422 self._PopulateResult( | 421 self._PopulateResult( |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 | 509 |
| 511 try: | 510 try: |
| 512 _AsyncProcessFlakeReport(flake_analysis_request, user_email, is_admin) | 511 _AsyncProcessFlakeReport(flake_analysis_request, user_email, is_admin) |
| 513 queued = True | 512 queued = True |
| 514 except Exception: | 513 except Exception: |
| 515 # Ignore the report when fail to queue it for async processing. | 514 # Ignore the report when fail to queue it for async processing. |
| 516 queued = False | 515 queued = False |
| 517 logging.exception('Failed to queue flake report for async processing') | 516 logging.exception('Failed to queue flake report for async processing') |
| 518 | 517 |
| 519 return _FlakeAnalysis(queued=queued) | 518 return _FlakeAnalysis(queued=queued) |
| OLD | NEW |