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

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

Issue 2425853005: [Findit] Modify Findit API to return more information to Sheriff-O-Matic. (Closed)
Patch Set: rebase Created 4 years, 1 month 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_build_model import BaseBuildModel
7 from model.base_suspected_cl import BaseSuspectedCL 8 from model.base_suspected_cl import BaseSuspectedCL
8 9
9 10
10 class WfSuspectedCL(BaseSuspectedCL): 11 class WfSuspectedCL(BaseSuspectedCL):
11 """Represents suspected cl that causes failures on Chromium waterfall builds. 12 """Represents suspected cl that causes failures on Chromium waterfall builds.
12 13
13 'Wf' is short for waterfall. 14 'Wf' is short for waterfall.
14 """ 15 """
15 16
16 # The dict of builds in which the suspected CL caused some breakage. 17 # The dict of builds in which the suspected CL caused some breakage.
17 # The dict will look like: 18 # The dict will look like:
18 # { 19 # {
19 # 'm1/b1/123': [ 20 # 'm1/b1/123': {
20 # { 21 # 'failure_type': 'compile',
21 # 'failure_type': 'compile', 22 # 'failures': None,
22 # 'failures': None, 23 # 'status': CORRECT,
23 # 'status': CORRECT, 24 # 'approaches': [HEURISTIC, TRY_JOB],
24 # 'approaches': [HEURISTIC, TRY_JOB], 25 # 'top_score': 5
25 # 'top_score': 5, 26 # },
26 # 'Confidence': 97.9 27 # 'm2/b2/234': {
27 # } 28 # 'failure_type': 'test',
28 # ], 29 # 'failures': {
29 # 'm2/b2/234': [ 30 # 's1': ['t1', 't2']
30 # {
31 # 'failure_type': 'test',
32 # 'failures': {
33 # 's1': ['t1', 't2']
34 # },
35 # 'status': CORRECT,
36 # 'approachES': [HEURISTIC, TRY_JOB],
37 # 'top_score': None,
38 # 'Confidence': 80.0
39 # }, 31 # },
40 # { 32 # 'status': CORRECT,
41 # 'failure_type': 'test', 33 # 'approachES': [HEURISTIC, TRY_JOB],
42 # 'failures': { 34 # 'top_score': None
43 # 's1': ['t3'] 35 # },
44 # }, 36 # {
45 # 'status': INCORRECT, 37 # 'failure_type': 'test',
46 # 'approaches': [HEURISTIC], 38 # 'failures': {
47 # 'top_score': 2, 39 # 's1': ['t3']
48 # 'Confidence': 50.5
49 # }, 40 # },
50 # { 41 # 'status': INCORRECT,
51 # 'failure_type': 'test', 42 # 'approaches': [HEURISTIC],
52 # 'failures': { 43 # 'top_score': 2
53 # 's2': [] 44 # },
54 # }, 45 # {
55 # 'status': INCORRECT, 46 # 'failure_type': 'test',
56 # 'approaches': [HEURISTIC], 47 # 'failures': {
57 # 'top_score': 1, 48 # 's2': []
58 # 'Confidence': 30.7 49 # },
59 # } 50 # 'status': INCORRECT,
60 # ] 51 # 'approaches': [HEURISTIC],
52 # 'top_score': 1
53 # }
61 # } 54 # }
62 builds = ndb.JsonProperty(indexed=False, compressed=True) 55 builds = ndb.JsonProperty(indexed=False, compressed=True)
63 56
64 # Is the suspected CL the culprit or not. 57 # Is the suspected CL the culprit or not.
65 # If not triaged, the status would be None. 58 # If not triaged, the status would be None.
66 # Other possible status are: suspected_cl_status.CORRECT, 59 # Other possible status are: suspected_cl_status.CORRECT,
67 # suspected_cl_status.INCORRECT, suspected_cl_status.PARTIALLY_CORRECT and 60 # suspected_cl_status.INCORRECT, suspected_cl_status.PARTIALLY_CORRECT and
68 # suspected_cl_status.PARTIALLY_TRIAGED. 61 # suspected_cl_status.PARTIALLY_TRIAGED.
69 status = ndb.IntegerProperty(indexed=True, default=None) 62 status = ndb.IntegerProperty(indexed=True, default=None)
70 63
71 # From which approach do we get this suspected CL: 64 # From which approach do we get this suspected CL:
72 # analysis_approach_type.HEURISTIC, analysis_approach_type.TRY_JOB or both. 65 # analysis_approach_type.HEURISTIC, analysis_approach_type.TRY_JOB or both.
73 approaches = ndb.IntegerProperty(indexed=True, repeated=True) 66 approaches = ndb.IntegerProperty(indexed=True, repeated=True)
74 67
75 # Failure type: failure_type.COMPILE, failure_type.TEST, 68 # Failure type: failure_type.COMPILE, failure_type.TEST,
76 # and if a CL caused a compile failure and another test failure, 69 # and if a CL caused a compile failure and another test failure,
77 # the failure_type would be both. 70 # the failure_type would be both.
78 failure_type = ndb.IntegerProperty(indexed=True, repeated=True) 71 failure_type = ndb.IntegerProperty(indexed=True, repeated=True)
79 72
80 @classmethod 73 @classmethod
81 def Create(cls, repo_name, revision, commit_position): # pragma: no cover 74 def Create(cls, repo_name, revision, commit_position): # pragma: no cover
82 instance = cls(key=cls._CreateKey(repo_name, revision)) 75 instance = cls(key=cls._CreateKey(repo_name, revision))
83 instance.repo_name = repo_name 76 instance.repo_name = repo_name
84 instance.revision = revision 77 instance.revision = revision
85 instance.commit_position = commit_position 78 instance.commit_position = commit_position
86 instance.builds = {} 79 instance.builds = {}
87 return instance 80 return instance
81
82 def GetBuildInfo(self, master_name, builder_name, build_number):
83 build_key = BaseBuildModel.CreateBuildId(
84 master_name, builder_name, build_number)
85 return self.builds.get(build_key)
OLDNEW
« no previous file with comments | « appengine/findit/model/test/wf_suspected_cl_test.py ('k') | appengine/findit/test/findit_api_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698