Chromium Code Reviews| Index: appengine/findit/model/wf_culprit.py |
| diff --git a/appengine/findit/model/wf_culprit.py b/appengine/findit/model/wf_culprit.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..f328a50a70d6ac08b816b8277eb495feb4e5eabe |
| --- /dev/null |
| +++ b/appengine/findit/model/wf_culprit.py |
| @@ -0,0 +1,43 @@ |
| +# Copyright 2016 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +from google.appengine.ext import ndb |
| + |
| + |
| +class WfCulprit(ndb.Model): |
| + """Represents a culprit that causes a group of failures on Chromium waterfall. |
| + |
| + 'Wf' is short for waterfall. |
| + """ |
| + |
| + # Repo or project name of the culprit, eg: chromium, etc. |
| + repo_name = ndb.StringProperty() |
| + |
| + # The Git hash revision of the culprit. |
| + revision = ndb.StringProperty(indexed=False) |
| + |
| + # When this culprit was first found. |
| + found_time = ndb.DateTimeProperty() |
|
lijeffrey
2016/06/21 00:07:34
do we want to index found_time should we ever want
stgao
2016/06/21 15:14:29
We do want to query for historical data to know wh
|
| + |
| + # The status of notification delivery. |
|
chanli
2016/06/21 17:50:31
Do you want to list the statuses here? For referen
stgao
2016/06/24 16:10:28
Done.
|
| + notification_status = ndb.IntegerProperty() |
| + |
| + # The list of builds in which the culprit caused some breakage. |
| + failed_builds = ndb.JsonProperty(indexed=False, default=[]) |
| + |
| + @property |
| + def project_name(self): # pragma: no cover |
|
chanli
2016/06/21 17:50:31
Why don't just use repo_name?
stgao
2016/06/24 16:10:28
This is for UI.
I'm more leaning to make repo_nam
|
| + return self.repo_name |
| + |
| + @classmethod |
| + def _CreateKey(cls, repo_name, revision): # pragma: no cover |
| + return ndb.Key(cls.__name__, '%s/%s' % (repo_name, revision)) |
| + |
| + @classmethod |
| + def Create(cls, repo_name, revision): # pragma: no cover |
| + return cls(key=cls._CreateKey(repo_name, revision)) |
| + |
| + @classmethod |
| + def Get(cls, repo_name, revision): # pragma: no cover |
| + return cls._CreateKey(repo_name, revision).get() |