Chromium Code Reviews| Index: appengine/findit/waterfall/identify_culprit_pipeline.py |
| diff --git a/appengine/findit/waterfall/identify_culprit_pipeline.py b/appengine/findit/waterfall/identify_culprit_pipeline.py |
| index ffdc5ec0b9be7916d1e13d5b692ff78061923ddb..47e4ba5b9bda91f65ba1e6913958ea4b84713f43 100644 |
| --- a/appengine/findit/waterfall/identify_culprit_pipeline.py |
| +++ b/appengine/findit/waterfall/identify_culprit_pipeline.py |
| @@ -2,6 +2,7 @@ |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| +import logging |
| from common import time_util |
| from common.pipeline_wrapper import BasePipeline |
| @@ -9,6 +10,8 @@ from model import result_status |
| from model import analysis_status |
| from model.wf_analysis import WfAnalysis |
| from waterfall import build_failure_analysis |
| +from waterfall.send_notification_for_culprit_pipeline import ( |
| + SendNotificationForCulpritPipeline) |
| def _GetResultAnalysisStatus(analysis_result): |
| @@ -50,6 +53,39 @@ def _GetSuspectedCLs(analysis_result): |
| return suspected_cls |
| +def _GetSuspectedCLFoundByHeuristicForCompile(analysis): |
| + """For compile failure, gets the suspected revision found by heuristic.""" |
| + if not analysis or not analysis.result: |
| + return None |
| + for failure in analysis.result.get('failures', []): |
| + if (failure['step_name'].lower() == 'compile' and |
| + len(failure['suspected_cls']) == 1): |
| + # Based on confidence calculation, suspected_cl found by heuristic for |
| + # compile is very likely to be the culprit. |
| + # Since the current confidence calculation is for results with single |
| + # suspected_cl, we might need to have the same regulation here. |
| + return failure['suspected_cls'][0] |
| + return None |
| + |
| + |
| +def _NotifyCompileCulprits( |
|
lijeffrey
2016/09/02 06:37:34
nit: Since this is for compile, shouldn't there on
chanli
2016/09/02 16:57:19
The changes on identify_culprit_pipeline has been
|
| + master_name, builder_name, build_number, analysis): |
| + """Notifies code review if found a culprit for compile failure.""" |
| + suspect_cl_for_compile = _GetSuspectedCLFoundByHeuristicForCompile(analysis) |
| + if not suspect_cl_for_compile: |
| + return |
| + |
| + try: |
| + pipeline = SendNotificationForCulpritPipeline( |
| + master_name, builder_name, build_number, |
| + suspect_cl_for_compile['repo_name'], |
| + suspect_cl_for_compile['revision']) |
| + pipeline.start() |
| + except Exception: # pragma: no cover. |
| + logging.exception( |
| + 'Failed to notify culprits found by heuristic for compile.') |
| + |
| + |
| class IdentifyCulpritPipeline(BasePipeline): |
| """A pipeline to identify culprit CLs for a build failure.""" |
| @@ -81,4 +117,7 @@ class IdentifyCulpritPipeline(BasePipeline): |
| analysis.end_time = time_util.GetUTCNow() |
| analysis.put() |
| - return analysis_result |
| + _NotifyCompileCulprits( |
| + master_name, builder_name, build_number, analysis) |
| + |
| + return analysis_result |