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 BaseAnalysis(BaseBuildModel): |
|
stgao
2016/07/14 18:01:33
Why this one is needed? Is it possible to reuse th
| |
| 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 | |
| 17 'Wf' is short for waterfall. | |
| 18 """ | 16 """ |
| 19 @staticmethod | |
| 20 def _CreateKey(master_name, builder_name, build_number): # pragma: no cover | |
| 21 return ndb.Key('WfAnalysis', | |
| 22 BaseBuildModel.CreateBuildId( | |
| 23 master_name, builder_name, build_number)) | |
| 24 | |
| 25 @staticmethod | |
| 26 def Create(master_name, builder_name, build_number): # pragma: no cover | |
| 27 return WfAnalysis( | |
| 28 key=WfAnalysis._CreateKey(master_name, builder_name, build_number)) | |
| 29 | |
| 30 @staticmethod | |
| 31 def Get(master_name, builder_name, build_number): # pragma: no cover | |
| 32 return WfAnalysis._CreateKey(master_name, builder_name, build_number).get() | |
| 33 | 17 |
| 34 @property | 18 @property |
| 35 def completed(self): | 19 def completed(self): |
| 36 return self.status in ( | 20 return self.status in ( |
| 37 analysis_status.COMPLETED, analysis_status.ERROR) | 21 analysis_status.COMPLETED, analysis_status.ERROR) |
| 38 | 22 |
| 39 @property | 23 @property |
| 40 def duration(self): | 24 def duration(self): |
| 41 if not self.completed or not self.end_time or not self.start_time: | 25 if not self.completed or not self.end_time or not self.start_time: |
| 42 return None | 26 return None |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 return failure_type.COMPILE | 92 return failure_type.COMPILE |
| 109 | 93 |
| 110 # Although the failed steps could be infra setup steps like "bot_update", | 94 # Although the failed steps could be infra setup steps like "bot_update", |
| 111 # for legacy data we just assume all of them are tests if not compile. | 95 # for legacy data we just assume all of them are tests if not compile. |
| 112 return failure_type.TEST | 96 return failure_type.TEST |
| 113 | 97 |
| 114 @property | 98 @property |
| 115 def failure_type_str(self): | 99 def failure_type_str(self): |
| 116 return failure_type.GetDescriptionForFailureType(self.failure_type) | 100 return failure_type.GetDescriptionForFailureType(self.failure_type) |
| 117 | 101 |
| 118 # When the build cycle started. | |
| 119 build_start_time = ndb.DateTimeProperty(indexed=True) | |
| 120 # Whether the build cycle has completed. | |
| 121 build_completed = ndb.BooleanProperty(indexed=False) | |
| 122 # Whether it is a compile failure, test failure, infra failure or others. | |
| 123 # Refer to common/waterfall/failure_type.py for all the failure types. | |
| 124 build_failure_type = ndb.IntegerProperty(indexed=False) | |
| 125 | |
| 126 # The url path to the pipeline status page. | 102 # The url path to the pipeline status page. |
| 127 pipeline_status_path = ndb.StringProperty(indexed=False) | 103 pipeline_status_path = ndb.StringProperty(indexed=False) |
| 104 | |
| 128 # The status of the analysis. | 105 # The status of the analysis. |
| 129 status = ndb.IntegerProperty( | 106 status = ndb.IntegerProperty( |
| 130 default=analysis_status.PENDING, indexed=False) | 107 default=analysis_status.PENDING, indexed=False) |
| 131 # When the analysis was requested. | 108 # When the analysis was requested. |
| 132 request_time = ndb.DateTimeProperty(indexed=False) | 109 request_time = ndb.DateTimeProperty(indexed=False) |
| 133 # When the analysis actually started. | 110 # When the analysis actually started. |
| 134 start_time = ndb.DateTimeProperty(indexed=False) | 111 start_time = ndb.DateTimeProperty(indexed=False) |
| 135 # When the analysis actually ended. | 112 # When the analysis actually ended. |
| 136 end_time = ndb.DateTimeProperty(indexed=False) | 113 end_time = ndb.DateTimeProperty(indexed=False) |
| 137 # When the analysis was updated. | 114 # When the analysis was updated. |
| 138 updated_time = ndb.DateTimeProperty(indexed=False, auto_now=True) | 115 updated_time = ndb.DateTimeProperty(indexed=False, auto_now=True) |
| 139 # Record which version of analysis. | 116 # Record which version of analysis. |
| 140 version = ndb.StringProperty(indexed=False) | 117 version = ndb.StringProperty(indexed=False) |
| 141 | |
| 142 # Analysis result for the build failure. | |
| 143 not_passed_steps = ndb.StringProperty(indexed=False, repeated=True) | |
| 144 result = ndb.JsonProperty(indexed=False, compressed=True) | |
| 145 # Suspected CLs we found. | |
| 146 suspected_cls = ndb.JsonProperty(indexed=False, compressed=True) | |
| 147 # Record the id of try job results of each failure. | |
| 148 failure_result_map = ndb.JsonProperty(indexed=False, compressed=True) | |
| 149 | |
| 150 # The actual culprit CLs that are responsible for the failures. | |
| 151 culprit_cls = ndb.JsonProperty(indexed=False, compressed=True) | |
| 152 # Conclusion of analysis result for the build failure: 'Found' or 'Not Found'. | |
| 153 result_status = ndb.IntegerProperty(indexed=True) | |
| 154 # Record the history of triage. | |
| 155 triage_history = ndb.JsonProperty(indexed=False, compressed=True) | |
| OLD | NEW |