Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 from google.appengine.ext import ndb | |
| 6 | |
| 7 | |
| 8 class WfCulprit(ndb.Model): | |
| 9 """Represents a culprit that causes a group of failures on Chromium waterfall. | |
| 10 | |
| 11 'Wf' is short for waterfall. | |
| 12 """ | |
| 13 | |
| 14 # Repo or project name of the culprit, eg: chromium, etc. | |
| 15 repo_name = ndb.StringProperty() | |
| 16 | |
| 17 # The Git hash revision of the culprit. | |
| 18 revision = ndb.StringProperty(indexed=False) | |
| 19 | |
| 20 # When this culprit was first found. | |
| 21 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
| |
| 22 | |
| 23 # 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.
| |
| 24 notification_status = ndb.IntegerProperty() | |
| 25 | |
| 26 # The list of builds in which the culprit caused some breakage. | |
| 27 failed_builds = ndb.JsonProperty(indexed=False, default=[]) | |
| 28 | |
| 29 @property | |
| 30 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
| |
| 31 return self.repo_name | |
| 32 | |
| 33 @classmethod | |
| 34 def _CreateKey(cls, repo_name, revision): # pragma: no cover | |
| 35 return ndb.Key(cls.__name__, '%s/%s' % (repo_name, revision)) | |
| 36 | |
| 37 @classmethod | |
| 38 def Create(cls, repo_name, revision): # pragma: no cover | |
| 39 return cls(key=cls._CreateKey(repo_name, revision)) | |
| 40 | |
| 41 @classmethod | |
| 42 def Get(cls, repo_name, revision): # pragma: no cover | |
| 43 return cls._CreateKey(repo_name, revision).get() | |
| OLD | NEW |