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

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

Issue 2320153003: [Findit] Datamodel change for triaging at CL level. (Closed)
Patch Set: change index.yaml Created 4 years, 3 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 7
8 class WfSuspectedCL(ndb.Model): 8 class BaseSuspectedCL(ndb.Model):
9 """Represents suspected cl that causes failures on Chromium waterfall builds. 9 """Represents base information about a suspected cl."""
10
11 'Wf' is short for waterfall.
12 """
13 10
14 # Repo or project name of the suspected CL, eg: chromium, etc. 11 # Repo or project name of the suspected CL, eg: chromium, etc.
15 repo_name = ndb.StringProperty(indexed=True) 12 repo_name = ndb.StringProperty(indexed=True)
16 13
17 # The Git hash revision of the suspected CL. 14 # The Git hash revision of the suspected CL.
18 revision = ndb.StringProperty(indexed=False) 15 revision = ndb.StringProperty(indexed=False)
19 16
20 # The commit position of the suspected CL. 17 # The commit position of the suspected CL.
21 # Might not be available for some repo. 18 # Might not be available for some repo.
22 commit_position = ndb.IntegerProperty(indexed=False) 19 commit_position = ndb.IntegerProperty(indexed=False)
23 20
24 # The list of builds in which the suspected CL caused some breakage. 21 # Time when the CL was identified as a suspect for the first time.
25 builds = ndb.JsonProperty(indexed=False) 22 identified_time = ndb.DateTimeProperty(indexed=False)
26 23
27 # Is the suspected CL the culprit or not. 24 # Time when the CL was updated.
28 is_culprit = ndb.BooleanProperty(indexed=True, default=None) 25 updated_time = ndb.DateTimeProperty(indexed=True)
29
30 # From which approach do we get this suspected CL: HEURISTIC, TRY_JOB or BOTH.
31 approach = ndb.IntegerProperty(indexed=True)
32
33 # Failure type: failure_type.COMPILE or failure_type.TEST.
34 failure_type = ndb.IntegerProperty(indexed=True)
35 26
36 @property 27 @property
37 def project_name(self): 28 def project_name(self):
38 return self.repo_name 29 return self.repo_name
39 30
40 @classmethod 31 @classmethod
41 def _CreateKey(cls, repo_name, revision): # pragma: no cover 32 def _CreateKey(cls, repo_name, revision): # pragma: no cover
42 return ndb.Key(cls.__name__, '%s/%s' % (repo_name, revision)) 33 return ndb.Key(cls.__name__, '%s/%s' % (repo_name, revision))
43 34
44 @classmethod 35 @classmethod
45 def Create(cls, repo_name, revision, commit_position): # pragma: no cover 36 def Create(cls, repo_name, revision, commit_position): # pragma: no cover
46 instance = cls(key=cls._CreateKey(repo_name, revision)) 37 instance = cls(key=cls._CreateKey(repo_name, revision))
47 instance.repo_name = repo_name 38 instance.repo_name = repo_name
48 instance.revision = revision 39 instance.revision = revision
49 instance.commit_position = commit_position 40 instance.commit_position = commit_position
50 instance.builds = []
51 return instance 41 return instance
52 42
53 @classmethod 43 @classmethod
54 def Get(cls, repo_name, revision): # pragma: no cover 44 def Get(cls, repo_name, revision): # pragma: no cover
55 return cls._CreateKey(repo_name, revision).get() 45 return cls._CreateKey(repo_name, revision).get()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698