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 google.appengine.ext import ndb | 5 from google.appengine.ext import ndb |
| 6 | 6 |
| 7 from common.git_repository import GitRepository | 7 from common.git_repository import GitRepository |
| 8 from common.http_client_appengine import HttpClientAppengine as HttpClient | 8 from common.http_client_appengine import HttpClientAppengine as HttpClient |
| 9 from common.pipeline_wrapper import BasePipeline | 9 from common.pipeline_wrapper import BasePipeline |
| 10 from model import analysis_status | 10 from model import analysis_status |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 161 if not report: | 161 if not report: |
| 162 return None | 162 return None |
| 163 | 163 |
| 164 if report.get('culprit'): | 164 if report.get('culprit'): |
| 165 return report.get('culprit') | 165 return report.get('culprit') |
| 166 | 166 |
| 167 return IdentifyTryJobCulpritPipeline._GetFailedRevisionFromResultsDict( | 167 return IdentifyTryJobCulpritPipeline._GetFailedRevisionFromResultsDict( |
| 168 report.get('result', {})) | 168 report.get('result', {})) |
| 169 | 169 |
| 170 def _FindCulpritForEachTestFailure(self, blame_list, result): | 170 def _FindCulpritForEachTestFailure(self, blame_list, result): |
| 171 # For test failures, the try job will run against every revision, | 171 # For test failures, we need to traverse the result dict in chronological |
| 172 # so we need to traverse the result dict in chronological order to identify | 172 # order to identify the culprits for each failed step or test. |
| 173 # the culprits for each failed step or test. | 173 # The earliest revision that a test failed is the culprit. |
| 174 culprit_map = {} | 174 culprit_map = {} |
| 175 failed_revisions = [] | 175 failed_revisions = [] |
| 176 test_results = result['report'].get('result') | |
| 177 | |
| 176 for revision in blame_list: | 178 for revision in blame_list: |
| 177 test_results = result['report'].get('result') | 179 if not test_results.get(revision): |
|
stgao
2016/05/04 21:40:18
How about let the recipe compute the culprits it f
chanli
2016/05/04 23:41:37
Done.
| |
| 180 continue | |
| 178 | 181 |
| 179 for step, test_result in test_results[revision].iteritems(): | 182 for step, test_result in test_results[revision].iteritems(): |
| 180 if (not test_result['valid'] or | 183 if (not test_result['valid'] or |
| 181 test_result['status'] != 'failed'): # pragma: no cover | 184 test_result['status'] != 'failed'): # pragma: no cover |
| 182 continue | 185 continue |
| 183 | 186 |
| 184 if revision not in failed_revisions: | 187 if revision not in failed_revisions: |
| 185 failed_revisions.append(revision) | 188 failed_revisions.append(revision) |
| 186 | 189 |
| 187 if step not in culprit_map: | 190 if step not in culprit_map: |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 292 analysis.result_status = updated_result_status | 295 analysis.result_status = updated_result_status |
| 293 analysis.suspected_cls = updated_suspected_cls | 296 analysis.suspected_cls = updated_suspected_cls |
| 294 analysis.put() | 297 analysis.put() |
| 295 | 298 |
| 296 # Store try-job results. | 299 # Store try-job results. |
| 297 UpdateTryJobResult() | 300 UpdateTryJobResult() |
| 298 # Add try-job results to WfAnalysis. | 301 # Add try-job results to WfAnalysis. |
| 299 UpdateWfAnalysisWithTryJobResult() | 302 UpdateWfAnalysisWithTryJobResult() |
| 300 | 303 |
| 301 return result.get('culprit') if result else None | 304 return result.get('culprit') if result else None |
| OLD | NEW |