Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 import constants | 7 from common import constants |
| 8 from common.waterfall import failure_type | 8 from common.waterfall import failure_type |
| 9 from model.base_build_model import BaseBuildModel | 9 from model.base_build_model import BaseBuildModel |
| 10 from model import analysis_status | 10 from model import analysis_status |
| 11 from model import result_status | 11 from model import result_status |
| 12 | 12 |
| 13 | 13 |
| 14 class WfAnalysis(BaseBuildModel): | 14 class WfAnalysis(BaseBuildModel): |
| 15 """Represents an analysis of a build of a builder in a Chromium waterfall. | 15 """Represents an analysis of a build of a builder in a Chromium waterfall. |
| 16 | 16 |
| 17 'Wf' is short for waterfall. | 17 'Wf' is short for waterfall. |
| 18 """ | 18 """ |
| 19 @staticmethod | 19 @staticmethod |
| 20 def _CreateKey(master_name, builder_name, build_number): # pragma: no cover | 20 def _CreateKey(master_name, builder_name, build_number): # pragma: no cover |
| 21 return ndb.Key('WfAnalysis', | 21 return ndb.Key('WfAnalysis', |
| 22 BaseBuildModel.CreateBuildId( | 22 BaseBuildModel.CreateBuildId( |
| 23 master_name, builder_name, build_number)) | 23 master_name, builder_name, build_number)) |
| 24 | 24 |
| 25 @staticmethod | 25 @staticmethod |
| 26 def Create(master_name, builder_name, build_number): # pragma: no cover | 26 def Create(master_name, builder_name, build_number): # pragma: no cover |
| 27 return WfAnalysis( | 27 analysis = WfAnalysis( |
| 28 key=WfAnalysis._CreateKey(master_name, builder_name, build_number)) | 28 key=WfAnalysis._CreateKey(master_name, builder_name, build_number)) |
| 29 if analysis.failure_result_map is None: | |
| 30 analysis.failure_result_map = {} | |
|
lijeffrey
2016/07/12 22:36:27
I think this can be simplified slightly with
anal
chanli
2016/07/12 22:54:56
Done.
| |
| 31 return analysis | |
| 29 | 32 |
| 30 @staticmethod | 33 @staticmethod |
| 31 def Get(master_name, builder_name, build_number): # pragma: no cover | 34 def Get(master_name, builder_name, build_number): # pragma: no cover |
| 32 return WfAnalysis._CreateKey(master_name, builder_name, build_number).get() | 35 return WfAnalysis._CreateKey(master_name, builder_name, build_number).get() |
| 33 | 36 |
| 34 @property | 37 @property |
| 35 def completed(self): | 38 def completed(self): |
| 36 return self.status in ( | 39 return self.status in ( |
| 37 analysis_status.COMPLETED, analysis_status.ERROR) | 40 analysis_status.COMPLETED, analysis_status.ERROR) |
| 38 | 41 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 146 suspected_cls = ndb.JsonProperty(indexed=False, compressed=True) | 149 suspected_cls = ndb.JsonProperty(indexed=False, compressed=True) |
| 147 # Record the id of try job results of each failure. | 150 # Record the id of try job results of each failure. |
| 148 failure_result_map = ndb.JsonProperty(indexed=False, compressed=True) | 151 failure_result_map = ndb.JsonProperty(indexed=False, compressed=True) |
| 149 | 152 |
| 150 # The actual culprit CLs that are responsible for the failures. | 153 # The actual culprit CLs that are responsible for the failures. |
| 151 culprit_cls = ndb.JsonProperty(indexed=False, compressed=True) | 154 culprit_cls = ndb.JsonProperty(indexed=False, compressed=True) |
| 152 # Conclusion of analysis result for the build failure: 'Found' or 'Not Found'. | 155 # Conclusion of analysis result for the build failure: 'Found' or 'Not Found'. |
| 153 result_status = ndb.IntegerProperty(indexed=True) | 156 result_status = ndb.IntegerProperty(indexed=True) |
| 154 # Record the history of triage. | 157 # Record the history of triage. |
| 155 triage_history = ndb.JsonProperty(indexed=False, compressed=True) | 158 triage_history = ndb.JsonProperty(indexed=False, compressed=True) |
| OLD | NEW |