Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1463)

Side by Side Diff: appengine/findit/model/wf_culprit.py

Issue 2116073002: [Findit] Fix redirect bug and update template for waterfall/culprit. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Add one unittest. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 8
9 9
10 class WfCulprit(ndb.Model): 10 class WfCulprit(ndb.Model):
11 """Represents a culprit that causes a group of failures on Chromium waterfall. 11 """Represents a culprit that causes a group of failures on Chromium waterfall.
12 12
13 'Wf' is short for waterfall. 13 'Wf' is short for waterfall.
14 """ 14 """
15 15
16 # Repo or project name of the culprit, eg: chromium, etc. 16 # Repo or project name of the culprit, eg: chromium, etc.
17 repo_name = ndb.StringProperty(indexed=True) 17 repo_name = ndb.StringProperty(indexed=True)
18 18
19 # The Git hash revision of the culprit. 19 # The Git hash revision of the culprit.
20 revision = ndb.StringProperty(indexed=False) 20 revision = ndb.StringProperty(indexed=False)
21 21
22 # The commit position of the culprit. Might not be available for some repo.
23 commit_position = ndb.IntegerProperty(indexed=False)
24
22 # When the code-review of this culprit was notified. 25 # When the code-review of this culprit was notified.
23 cr_notification_time = ndb.DateTimeProperty(indexed=True) 26 cr_notification_time = ndb.DateTimeProperty(indexed=True)
24 27
25 # The status of code-review notification: None, RUNNING, COMPLETED, ERROR. 28 # The status of code-review notification: None, RUNNING, COMPLETED, ERROR.
26 cr_notification_status = ndb.IntegerProperty(indexed=True) 29 cr_notification_status = ndb.IntegerProperty(indexed=True)
27 30
28 # The list of builds in which the culprit caused some breakage. 31 # The list of builds in which the culprit caused some breakage.
29 builds = ndb.JsonProperty(indexed=False) 32 builds = ndb.JsonProperty(indexed=False)
30 33
31 @property 34 @property
32 def project_name(self): 35 def project_name(self):
33 return self.repo_name 36 return self.repo_name
34 37
35 @property 38 @property
36 def cr_notification_processed(self): 39 def cr_notification_processed(self):
37 return self.cr_notification_status in (status.COMPLETED, status.RUNNING) 40 return self.cr_notification_status in (status.COMPLETED, status.RUNNING)
38 41
39 @property 42 @property
40 def cr_notified(self): 43 def cr_notified(self):
41 return self.cr_notification_status == status.COMPLETED 44 return self.cr_notification_status == status.COMPLETED
42 45
43 @classmethod 46 @classmethod
44 def _CreateKey(cls, repo_name, revision): # pragma: no cover 47 def _CreateKey(cls, repo_name, revision): # pragma: no cover
45 return ndb.Key(cls.__name__, '%s/%s' % (repo_name, revision)) 48 return ndb.Key(cls.__name__, '%s/%s' % (repo_name, revision))
46 49
47 @classmethod 50 @classmethod
48 def Create(cls, repo_name, revision): # pragma: no cover 51 def Create(cls, repo_name, revision, commit_position): # pragma: no cover
49 instance = cls(key=cls._CreateKey(repo_name, revision)) 52 instance = cls(key=cls._CreateKey(repo_name, revision))
50 instance.repo_name = repo_name 53 instance.repo_name = repo_name
51 instance.revision = revision 54 instance.revision = revision
55 instance.commit_position = commit_position
52 instance.builds = [] 56 instance.builds = []
53 return instance 57 return instance
54 58
55 @classmethod 59 @classmethod
56 def Get(cls, repo_name, revision): # pragma: no cover 60 def Get(cls, repo_name, revision): # pragma: no cover
57 return cls._CreateKey(repo_name, revision).get() 61 return cls._CreateKey(repo_name, revision).get()
OLDNEW
« no previous file with comments | « appengine/findit/model/test/wf_culprit_test.py ('k') | appengine/findit/templates/waterfall/culprit.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698