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

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

Issue 2225723005: [Findit] Add WfSuspectedCL model to save triage results for each suspected CL. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 4 years, 4 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
8 7
9 8 class WfSuspectedCL(ndb.Model):
10 class WfCulprit(ndb.Model): 9 """Represents suspected cl that causes failures on Chromium waterfall builds.
11 """Represents a culprit that causes a group of failures on Chromium waterfall.
12 10
13 'Wf' is short for waterfall. 11 'Wf' is short for waterfall.
14 """ 12 """
15 13
16 # Repo or project name of the culprit, eg: chromium, etc. 14 # Repo or project name of the suspected CL, eg: chromium, etc.
17 repo_name = ndb.StringProperty(indexed=True) 15 repo_name = ndb.StringProperty(indexed=True)
18 16
19 # The Git hash revision of the culprit. 17 # The Git hash revision of the suspected CL.
20 revision = ndb.StringProperty(indexed=False) 18 revision = ndb.StringProperty(indexed=False)
21 19
22 # The commit position of the culprit. Might not be available for some repo. 20 # The commit position of the suspected CL.
21 # Might not be available for some repo.
23 commit_position = ndb.IntegerProperty(indexed=False) 22 commit_position = ndb.IntegerProperty(indexed=False)
24 23
25 # When the code-review of this culprit was notified. 24 # The list of builds in which the suspected CL caused some breakage.
26 cr_notification_time = ndb.DateTimeProperty(indexed=True) 25 builds = ndb.JsonProperty(indexed=False)
27 26
28 # The status of code-review notification: None, RUNNING, COMPLETED, ERROR. 27 # Is the suspected CL the culprit or not.
29 cr_notification_status = ndb.IntegerProperty(indexed=True) 28 is_culprit = ndb.BooleanProperty(indexed=True, default=None)
30 29
31 # The list of builds in which the culprit caused some breakage. 30 # From which approach do we get this suspected CL: HEURISTIC, TRY_JOB or BOTH.
32 builds = ndb.JsonProperty(indexed=False) 31 approach = ndb.IntegerProperty(indexed=True)
32
33 # Failure type: failure_type.COMPILE or failure_type.TEST.
34 failure_type = ndb.IntegerProperty(indexed=True)
33 35
34 @property 36 @property
35 def project_name(self): 37 def project_name(self):
36 return self.repo_name 38 return self.repo_name
37 39
38 @property
39 def cr_notification_processed(self):
40 return self.cr_notification_status in (status.COMPLETED, status.RUNNING)
41
42 @property
43 def cr_notified(self):
44 return self.cr_notification_status == status.COMPLETED
45
46 @classmethod 40 @classmethod
47 def _CreateKey(cls, repo_name, revision): # pragma: no cover 41 def _CreateKey(cls, repo_name, revision): # pragma: no cover
48 return ndb.Key(cls.__name__, '%s/%s' % (repo_name, revision)) 42 return ndb.Key(cls.__name__, '%s/%s' % (repo_name, revision))
49 43
50 @classmethod 44 @classmethod
51 def Create(cls, repo_name, revision, commit_position): # pragma: no cover 45 def Create(cls, repo_name, revision, commit_position): # pragma: no cover
52 instance = cls(key=cls._CreateKey(repo_name, revision)) 46 instance = cls(key=cls._CreateKey(repo_name, revision))
53 instance.repo_name = repo_name 47 instance.repo_name = repo_name
54 instance.revision = revision 48 instance.revision = revision
55 instance.commit_position = commit_position 49 instance.commit_position = commit_position
56 instance.builds = [] 50 instance.builds = []
57 return instance 51 return instance
58 52
59 @classmethod 53 @classmethod
60 def Get(cls, repo_name, revision): # pragma: no cover 54 def Get(cls, repo_name, revision): # pragma: no cover
61 return cls._CreateKey(repo_name, revision).get() 55 return cls._CreateKey(repo_name, revision).get()
OLDNEW
« appengine/findit/model/approach_type.py ('K') | « appengine/findit/model/wf_culprit.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698