Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 model import analysis_status as status | 7 from model import analysis_status as status |
| 8 from model.wf_suspected_cl import WfSuspectedCL | 8 from model.base_cl import BaseCL |
| 9 | 9 |
| 10 | 10 |
| 11 class WfCulprit(WfSuspectedCL): | 11 class WfCulprit(BaseCL): |
| 12 """Represents a culprit that causes a group of failures on Chromium waterfall. | 12 """Represents a culprit that causes a group of failures on Chromium waterfall. |
| 13 | 13 |
| 14 'Wf' is short for waterfall. | 14 'Wf' is short for waterfall. |
| 15 """ | 15 """ |
| 16 # The list of builds in which the culprit caused some breakage. | |
| 17 builds = ndb.JsonProperty(indexed=False) | |
|
lijeffrey
2016/09/08 22:09:24
so we indeed want this in both WfSuspectedCL and i
chanli
2016/09/08 22:32:29
For culprit a list of builds is enough, but we nee
| |
| 16 | 18 |
| 17 # When the code-review of this culprit was notified. | 19 # When the code-review of this culprit was notified. |
| 18 cr_notification_time = ndb.DateTimeProperty(indexed=True) | 20 cr_notification_time = ndb.DateTimeProperty(indexed=True) |
| 19 | 21 |
| 20 # The status of code-review notification: None, RUNNING, COMPLETED, ERROR. | 22 # The status of code-review notification: None, RUNNING, COMPLETED, ERROR. |
| 21 cr_notification_status = ndb.IntegerProperty(indexed=True) | 23 cr_notification_status = ndb.IntegerProperty(indexed=True) |
| 22 | 24 |
| 23 @property | 25 @property |
| 24 def cr_notification_processed(self): | 26 def cr_notification_processed(self): |
| 25 return self.cr_notification_status in (status.COMPLETED, status.RUNNING) | 27 return self.cr_notification_status in (status.COMPLETED, status.RUNNING) |
| 26 | 28 |
| 27 @property | 29 @property |
| 28 def cr_notified(self): | 30 def cr_notified(self): |
| 29 return self.cr_notification_status == status.COMPLETED | 31 return self.cr_notification_status == status.COMPLETED |
| 32 | |
| 33 @classmethod | |
| 34 def Create(cls, repo_name, revision, commit_position): # pragma: no cover | |
| 35 instance = cls(key=cls._CreateKey(repo_name, revision)) | |
| 36 instance.repo_name = repo_name | |
| 37 instance.revision = revision | |
| 38 instance.commit_position = commit_position | |
| 39 instance.builds = [] | |
| 40 return instance | |
| OLD | NEW |