| 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 | 6 |
| 7 from common.pipeline_wrapper import BasePipeline | 7 from common.pipeline_wrapper import BasePipeline |
| 8 from model import analysis_approach_type |
| 9 from model import analysis_status |
| 8 from model import result_status | 10 from model import result_status |
| 9 from model import analysis_status | |
| 10 from model.wf_analysis import WfAnalysis | 11 from model.wf_analysis import WfAnalysis |
| 11 from waterfall import build_failure_analysis | 12 from waterfall import build_failure_analysis |
| 13 from waterfall import suspected_cl_util |
| 12 | 14 |
| 13 | 15 |
| 14 def _GetResultAnalysisStatus(analysis_result): | 16 def _GetResultAnalysisStatus(analysis_result): |
| 15 """Returns the status of the analysis result. | 17 """Returns the status of the analysis result. |
| 16 | 18 |
| 17 We can decide the status based on: | 19 We can decide the status based on: |
| 18 1. whether we found any suspected CL(s). | 20 1. whether we found any suspected CL(s). |
| 19 2. whether we have triaged the failure. | 21 2. whether we have triaged the failure. |
| 20 3. whether our analysis result is the same as triaged result. | 22 3. whether our analysis result is the same as triaged result. |
| 21 """ | 23 """ |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 failure_info, change_logs, deps_info, signals) | 76 failure_info, change_logs, deps_info, signals) |
| 75 analysis = WfAnalysis.Get(master_name, builder_name, build_number) | 77 analysis = WfAnalysis.Get(master_name, builder_name, build_number) |
| 76 analysis.build_completed = build_completed | 78 analysis.build_completed = build_completed |
| 77 analysis.result = analysis_result | 79 analysis.result = analysis_result |
| 78 analysis.status = analysis_status.COMPLETED | 80 analysis.status = analysis_status.COMPLETED |
| 79 analysis.result_status = _GetResultAnalysisStatus(analysis_result) | 81 analysis.result_status = _GetResultAnalysisStatus(analysis_result) |
| 80 analysis.suspected_cls = _GetSuspectedCLs(analysis_result) | 82 analysis.suspected_cls = _GetSuspectedCLs(analysis_result) |
| 81 analysis.end_time = datetime.utcnow() | 83 analysis.end_time = datetime.utcnow() |
| 82 analysis.put() | 84 analysis.put() |
| 83 | 85 |
| 84 return analysis_result | 86 # Creates and/or updates WfSuspectedCL entities for suspected cls. |
| 87 for suspected_cl in analysis.suspected_cls: |
| 88 suspected_cl_util.UpdateSuspectedCL( |
| 89 analysis_approach_type.HEURISTIC, master_name, builder_name, |
| 90 build_number, failure_info['failure_type'], suspected_cl['repo_name'], |
| 91 suspected_cl['revision'], suspected_cl['commit_position']) |
| 92 return analysis_result |
| OLD | NEW |