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 | 7 |
| 8 class WfSuspectedCL(ndb.Model): | 8 class WfSuspectedCL(ndb.Model): |
| 9 """Represents suspected cl that causes failures on Chromium waterfall builds. | 9 """Represents suspected cl that causes failures on Chromium waterfall builds. |
| 10 | 10 |
| 11 'Wf' is short for waterfall. | 11 'Wf' is short for waterfall. |
| 12 """ | 12 """ |
| 13 | 13 |
| 14 # Repo or project name of the suspected CL, eg: chromium, etc. | 14 # Repo or project name of the suspected CL, eg: chromium, etc. |
| 15 repo_name = ndb.StringProperty(indexed=True) | 15 repo_name = ndb.StringProperty(indexed=True) |
| 16 | 16 |
| 17 # The Git hash revision of the suspected CL. | 17 # The Git hash revision of the suspected CL. |
| 18 revision = ndb.StringProperty(indexed=False) | 18 revision = ndb.StringProperty(indexed=False) |
| 19 | 19 |
| 20 # The commit position of the suspected CL. | 20 # The commit position of the suspected CL. |
| 21 # Might not be available for some repo. | 21 # Might not be available for some repo. |
| 22 commit_position = ndb.IntegerProperty(indexed=False) | 22 commit_position = ndb.IntegerProperty(indexed=False) |
| 23 | 23 |
| 24 # The list of builds in which the suspected CL caused some breakage. | 24 # The list of builds in which the suspected CL caused some breakage. |
| 25 builds = ndb.JsonProperty(indexed=False) | 25 builds = ndb.JsonProperty(indexed=False) |
| 26 | 26 |
| 27 # Is the suspected CL the culprit or not. | 27 # Is the suspected CL the culprit or not. |
| 28 is_culprit = ndb.BooleanProperty(indexed=True, default=None) | 28 is_culprit = ndb.BooleanProperty(indexed=True, default=None) |
|
Sharu Jiang
2016/08/12 17:45:04
The property default is already None, so this can
chanli
2016/08/16 16:53:52
Done.
| |
| 29 | 29 |
| 30 # From which approach do we get this suspected CL: HEURISTIC, TRY_JOB or BOTH. | 30 # From which approach do we get this suspected CL: HEURISTIC, TRY_JOB or BOTH. |
| 31 approach = ndb.IntegerProperty(indexed=True) | 31 approach = ndb.IntegerProperty(indexed=True, default=None) |
|
Sharu Jiang
2016/08/12 17:45:04
Ditto.
chanli
2016/08/16 16:53:52
Done.
| |
| 32 | 32 |
| 33 # Failure type: failure_type.COMPILE or failure_type.TEST. | 33 # Failure type: failure_type.COMPILE or failure_type.TEST. |
| 34 failure_type = ndb.IntegerProperty(indexed=True) | 34 failure_type = ndb.IntegerProperty(indexed=True) |
| 35 | 35 |
| 36 @property | 36 @property |
| 37 def project_name(self): | 37 def project_name(self): |
| 38 return self.repo_name | 38 return self.repo_name |
| 39 | 39 |
| 40 @classmethod | 40 @classmethod |
| 41 def _CreateKey(cls, repo_name, revision): # pragma: no cover | 41 def _CreateKey(cls, repo_name, revision): # pragma: no cover |
| 42 return ndb.Key(cls.__name__, '%s/%s' % (repo_name, revision)) | 42 return ndb.Key(cls.__name__, '%s/%s' % (repo_name, revision)) |
| 43 | 43 |
| 44 @classmethod | 44 @classmethod |
| 45 def Create(cls, repo_name, revision, commit_position): # pragma: no cover | 45 def Create(cls, repo_name, revision, commit_position): # pragma: no cover |
| 46 instance = cls(key=cls._CreateKey(repo_name, revision)) | 46 instance = cls(key=cls._CreateKey(repo_name, revision)) |
| 47 instance.repo_name = repo_name | 47 instance.repo_name = repo_name |
| 48 instance.revision = revision | 48 instance.revision = revision |
| 49 instance.commit_position = commit_position | 49 instance.commit_position = commit_position |
| 50 instance.builds = [] | 50 instance.builds = [] |
| 51 return instance | 51 return instance |
| 52 | 52 |
| 53 @classmethod | 53 @classmethod |
| 54 def Get(cls, repo_name, revision): # pragma: no cover | 54 def Get(cls, repo_name, revision): # pragma: no cover |
| 55 return cls._CreateKey(repo_name, revision).get() | 55 return cls._CreateKey(repo_name, revision).get() |
| OLD | NEW |