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

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

Issue 2230103002: [Findit] Pipeline change to save suspected cls to data store. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@0808-resubmit-suspected_cl_model
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 7
8 class WfSuspectedCL(ndb.Model): 8 class WfSuspectedCL(ndb.Model):
9 """Represents suspected cl that causes failures on Chromium waterfall builds. 9 """Represents suspected cl that causes failures on Chromium waterfall builds.
10 10
(...skipping 10 matching lines...) Expand all
21 # Might not be available for some repo. 21 # Might not be available for some repo.
22 commit_position = ndb.IntegerProperty(indexed=False) 22 commit_position = ndb.IntegerProperty(indexed=False)
23 23
24 # The list of builds in which the suspected CL caused some breakage. 24 # The list of builds in which the suspected CL caused some breakage.
25 builds = ndb.JsonProperty(indexed=False) 25 builds = ndb.JsonProperty(indexed=False)
26 26
27 # Is the suspected CL the culprit or not. 27 # Is the suspected CL the culprit or not.
28 is_culprit = ndb.BooleanProperty(indexed=True, default=None) 28 is_culprit = ndb.BooleanProperty(indexed=True, default=None)
29 29
30 # From which approach do we get this suspected CL: HEURISTIC, TRY_JOB or BOTH. 30 # From which approach do we get this suspected CL: HEURISTIC, TRY_JOB or BOTH.
31 approach = ndb.IntegerProperty(indexed=True) 31 approach = ndb.IntegerProperty(indexed=True, default=None)
32 32
33 # Failure type: failure_type.COMPILE or failure_type.TEST. 33 # Failure type: failure_type.COMPILE or failure_type.TEST.
34 failure_type = ndb.IntegerProperty(indexed=True) 34 failure_type = ndb.IntegerProperty(indexed=True)
35 35
36 @property 36 @property
37 def project_name(self): 37 def project_name(self):
38 return self.repo_name 38 return self.repo_name
39 39
40 @classmethod 40 @classmethod
41 def _CreateKey(cls, repo_name, revision): # pragma: no cover 41 def _CreateKey(cls, repo_name, revision): # pragma: no cover
42 return ndb.Key(cls.__name__, '%s/%s' % (repo_name, revision)) 42 return ndb.Key(cls.__name__, '%s/%s' % (repo_name, revision))
43 43
44 @classmethod 44 @classmethod
45 def Create(cls, repo_name, revision, commit_position): # pragma: no cover 45 def Create(cls, repo_name, revision, commit_position): # pragma: no cover
46 instance = cls(key=cls._CreateKey(repo_name, revision)) 46 instance = cls(key=cls._CreateKey(repo_name, revision))
47 instance.repo_name = repo_name 47 instance.repo_name = repo_name
48 instance.revision = revision 48 instance.revision = revision
49 instance.commit_position = commit_position 49 instance.commit_position = commit_position
50 instance.builds = [] 50 instance.builds = []
51 return instance 51 return instance
52 52
53 @classmethod 53 @classmethod
54 def Get(cls, repo_name, revision): # pragma: no cover 54 def Get(cls, repo_name, revision): # pragma: no cover
55 return cls._CreateKey(repo_name, revision).get() 55 return cls._CreateKey(repo_name, revision).get()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698