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 collections import defaultdict | 5 from collections import defaultdict |
| 6 import logging | |
| 6 | 7 |
| 7 from google.appengine.ext import ndb | 8 from google.appengine.ext import ndb |
| 8 | 9 |
| 9 from common.git_repository import GitRepository | 10 from common.git_repository import GitRepository |
| 10 from common.http_client_appengine import HttpClientAppengine as HttpClient | 11 from common.http_client_appengine import HttpClientAppengine as HttpClient |
| 11 from common.pipeline_wrapper import BasePipeline | 12 from common.pipeline_wrapper import BasePipeline |
| 12 from model import analysis_status | 13 from model import analysis_status |
| 13 from model import result_status | 14 from model import result_status |
| 14 from model.wf_analysis import WfAnalysis | 15 from model.wf_analysis import WfAnalysis |
| 15 from model.wf_try_job import WfTryJob | 16 from model.wf_try_job import WfTryJob |
| 16 from model.wf_try_job_data import WfTryJobData | 17 from model.wf_try_job_data import WfTryJobData |
| 17 from waterfall.try_job_type import TryJobType | 18 from waterfall.try_job_type import TryJobType |
| 19 from waterfall.send_notification_for_culprit_pipeline import \ | |
|
lijeffrey
2016/06/21 00:07:34
nit: I think gpylint doesn't like multi-line lines
stgao
2016/06/21 15:14:29
Done.
| |
| 20 SendNotificationForCulpritPipeline | |
| 18 | 21 |
| 19 | 22 |
| 20 GIT_REPO = GitRepository( | 23 GIT_REPO = GitRepository( |
| 21 'https://chromium.googlesource.com/chromium/src.git', HttpClient()) | 24 'https://chromium.googlesource.com/chromium/src.git', HttpClient()) |
| 22 | 25 |
| 23 | 26 |
| 24 def _GetResultAnalysisStatus(analysis, result): | 27 def _GetResultAnalysisStatus(analysis, result): |
| 25 """Returns the analysis status based on existing status and try job result. | 28 """Returns the analysis status based on existing status and try job result. |
| 26 | 29 |
| 27 Args: | 30 Args: |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 else: | 93 else: |
| 91 for test_cl_info in results['tests'].values(): | 94 for test_cl_info in results['tests'].values(): |
| 92 revision = test_cl_info.get('revision') | 95 revision = test_cl_info.get('revision') |
| 93 if revision not in suspected_cl_revisions: | 96 if revision not in suspected_cl_revisions: |
| 94 suspected_cl_revisions.append(revision) | 97 suspected_cl_revisions.append(revision) |
| 95 suspected_cls.append(test_cl_info) | 98 suspected_cls.append(test_cl_info) |
| 96 | 99 |
| 97 return suspected_cls | 100 return suspected_cls |
| 98 | 101 |
| 99 | 102 |
| 103 def _NotifyCulprits(master_name, builder_name, build_number, culprits): | |
| 104 """Sends notifications to the identified culprits.""" | |
| 105 try: | |
| 106 for culprit in (culprits or {}).itervalues(): | |
| 107 pipeline = SendNotificationForCulpritPipeline( | |
| 108 master_name, builder_name, build_number, | |
| 109 culprit['repo_name'], culprit['revision']) | |
| 110 pipeline.start() | |
| 111 except Exception: | |
| 112 logging.exception('Failed to notify culprits.') | |
| 113 | |
| 114 | |
| 100 class IdentifyTryJobCulpritPipeline(BasePipeline): | 115 class IdentifyTryJobCulpritPipeline(BasePipeline): |
| 101 """A pipeline to identify culprit CL info based on try job compile results.""" | 116 """A pipeline to identify culprit CL info based on try job compile results.""" |
| 102 | 117 |
| 103 def _GetCulpritInfo(self, failed_revisions): | 118 def _GetCulpritInfo(self, failed_revisions): |
| 104 """Gets commit_positions and review urls for revisions.""" | 119 """Gets commit_positions and review urls for revisions.""" |
| 105 culprits = {} | 120 culprits = {} |
| 106 # TODO(lijeffrey): remove hard-coded 'chromium' when DEPS file parsing is | 121 # TODO(lijeffrey): remove hard-coded 'chromium' when DEPS file parsing is |
| 107 # supported. | 122 # supported. |
| 108 for failed_revision in failed_revisions: | 123 for failed_revision in failed_revisions: |
| 109 culprits[failed_revision] = { | 124 culprits[failed_revision] = { |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 319 analysis.suspected_cls != updated_suspected_cls): | 334 analysis.suspected_cls != updated_suspected_cls): |
| 320 analysis.result_status = updated_result_status | 335 analysis.result_status = updated_result_status |
| 321 analysis.suspected_cls = updated_suspected_cls | 336 analysis.suspected_cls = updated_suspected_cls |
| 322 analysis.put() | 337 analysis.put() |
| 323 | 338 |
| 324 # Store try-job results. | 339 # Store try-job results. |
| 325 UpdateTryJobResult() | 340 UpdateTryJobResult() |
| 326 # Add try-job results to WfAnalysis. | 341 # Add try-job results to WfAnalysis. |
| 327 UpdateWfAnalysisWithTryJobResult() | 342 UpdateWfAnalysisWithTryJobResult() |
| 328 | 343 |
| 344 _NotifyCulprits(master_name, builder_name, build_number, culprits) | |
|
chanli
2016/06/21 17:50:31
So only culprits found by try jobs will be include
stgao
2016/06/24 16:10:28
That's what I thought. Are you proposing heuristic
chanli
2016/06/24 23:42:38
Such as the case where the culprit revision is ski
| |
| 329 return result.get('culprit') if result else None | 345 return result.get('culprit') if result else None |
| OLD | NEW |