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

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

Issue 2320153003: [Findit] Datamodel change for triaging at CL level. (Closed)
Patch Set: . 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 from model.base_suspected_cl import BaseSuspectedCL
7 8
8 class WfSuspectedCL(ndb.Model): 9
10 class WfSuspectedCL(BaseSuspectedCL):
9 """Represents suspected cl that causes failures on Chromium waterfall builds. 11 """Represents suspected cl that causes failures on Chromium waterfall builds.
10 12
11 'Wf' is short for waterfall. 13 'Wf' is short for waterfall.
12 """ 14 """
13 15
14 # Repo or project name of the suspected CL, eg: chromium, etc. 16 # The dict of builds in which the suspected CL caused some breakage.
15 repo_name = ndb.StringProperty(indexed=True) 17 # The dict will look like:
16 18 # {
17 # The Git hash revision of the suspected CL. 19 # 'm1/b1/123': [
18 revision = ndb.StringProperty(indexed=False) 20 # {
19 21 # 'failure_type': 'compile',
20 # The commit position of the suspected CL. 22 # 'failures': None,
21 # Might not be available for some repo. 23 # 'status': CORRECT,
22 commit_position = ndb.IntegerProperty(indexed=False) 24 # 'approach': BOTH,
23 25 # 'top_score': 5,
24 # The list of builds in which the suspected CL caused some breakage. 26 # 'Confidence': 97.9
27 # }
28 # ],
29 # 'm2/b2/234': [
30 # {
31 # 'failure_type': 'test',
32 # 'failures': {
33 # 's1': ['t1', 't2']
34 # },
35 # 'status': CORRECT,
36 # 'approach': BOTH,
37 # 'top_score': None,
38 # 'Confidence': 80.0
39 # },
40 # {
41 # 'failure_type': 'test',
42 # 'failures': {
43 # 's1': ['t3']
44 # },
45 # 'status': INCORRECT,
46 # 'approach': HEURISTIC,
47 # 'top_score': 2,
48 # 'Confidence': 50.5
49 # },
50 # {
51 # 'failure_type': 'test',
52 # 'failures': {
53 # 's2': []
54 # },
55 # 'status': INCORRECT,
56 # 'approach': HEURISTIC,
57 # 'top_score': 1,
58 # 'Confidence': 30.7
59 # }
60 # ]
61 # }
25 builds = ndb.JsonProperty(indexed=False) 62 builds = ndb.JsonProperty(indexed=False)
stgao 2016/09/13 17:23:27 Do use compressed=True here. This will grow big.
chanli 2016/09/13 18:06:30 Done.
26 63
27 # Is the suspected CL the culprit or not. 64 # Is the suspected CL the culprit or not.
28 is_culprit = ndb.BooleanProperty(indexed=True, default=None) 65 # If not triaged, the status would be None.
66 # Other possible status are: suspected_cl_status.CORRECT,
67 # suspected_cl_status.INCORRECT, suspected_cl_status.PARTIALLY_CORRECT and
68 # suspected_cl_status.PARTIALLY_TRIAGED.
69 status = ndb.IntegerProperty(indexed=True, default=None)
29 70
30 # From which approach do we get this suspected CL: HEURISTIC, TRY_JOB or BOTH. 71 # From which approach do we get this suspected CL:
72 # analysis_approach_type.HEURISTIC, analysis_approach_type.TRY_JOB or
73 # analysis_approach_type.BOTH.
31 approach = ndb.IntegerProperty(indexed=True) 74 approach = ndb.IntegerProperty(indexed=True)
32 75
33 # Failure type: failure_type.COMPILE or failure_type.TEST. 76 # Failure type: failure_type.COMPILE, failure_type.TEST or failure_type.BOTH.
stgao 2016/09/13 17:23:27 Worth a comment to say a CL could cause compile an
chanli 2016/09/13 18:06:30 Done.
34 failure_type = ndb.IntegerProperty(indexed=True) 77 failure_type = ndb.IntegerProperty(indexed=True)
35 78
36 @property
37 def project_name(self):
38 return self.repo_name
39
40 @classmethod
41 def _CreateKey(cls, repo_name, revision): # pragma: no cover
42 return ndb.Key(cls.__name__, '%s/%s' % (repo_name, revision))
43
44 @classmethod 79 @classmethod
45 def Create(cls, repo_name, revision, commit_position): # pragma: no cover 80 def Create(cls, repo_name, revision, commit_position): # pragma: no cover
46 instance = cls(key=cls._CreateKey(repo_name, revision)) 81 instance = cls(key=cls._CreateKey(repo_name, revision))
47 instance.repo_name = repo_name 82 instance.repo_name = repo_name
48 instance.revision = revision 83 instance.revision = revision
49 instance.commit_position = commit_position 84 instance.commit_position = commit_position
50 instance.builds = [] 85 instance.builds = {}
51 return instance 86 return instance
52
53 @classmethod
54 def Get(cls, repo_name, revision): # pragma: no cover
55 return cls._CreateKey(repo_name, revision).get()
OLDNEW
« appengine/findit/model/base_suspected_cl.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