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

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

Issue 2086113004: [Findit] Show build analysis references in UI for Findit Cross-platform auto-triage (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@build-matching
Patch Set: Merged with ("rebased" on) Issue 2029873002's code. Other changes. Created 4 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 common import constants 7 from common import constants
8 from common.waterfall import failure_type 8 from common.waterfall import failure_type
9 from model.base_build_model import BaseBuildModel 9 from model.base_build_model import BaseBuildModel
10 from model import analysis_status 10 from model import analysis_status
11 from model import result_status 11 from model import result_status
12 12
13 13
14 class WfAnalysis(BaseBuildModel): 14 class WfAnalysis(BaseBuildModel):
15 """Represents an analysis of a build of a builder in a Chromium waterfall. 15 """Represents an analysis of a build of a builder in a Chromium waterfall.
16 16
17 'Wf' is short for waterfall. 17 'Wf' is short for waterfall.
18 """ 18 """
19
19 @staticmethod 20 @staticmethod
20 def _CreateKey(master_name, builder_name, build_number): # pragma: no cover 21 def _CreateKey(master_name, builder_name, build_number): # pragma: no cover
21 return ndb.Key('WfAnalysis', 22 return ndb.Key('WfAnalysis',
22 BaseBuildModel.CreateBuildId( 23 BaseBuildModel.CreateBuildId(
23 master_name, builder_name, build_number)) 24 master_name, builder_name, build_number))
24 25
25 @staticmethod 26 @staticmethod
26 def Create(master_name, builder_name, build_number): # pragma: no cover 27 def Create(master_name, builder_name, build_number): # pragma: no cover
27 return WfAnalysis( 28 return WfAnalysis(
28 key=WfAnalysis._CreateKey(master_name, builder_name, build_number)) 29 key=WfAnalysis._CreateKey(master_name, builder_name, build_number))
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 return True 76 return True
76 77
77 if self.result_status in ( 78 if self.result_status in (
78 result_status.FOUND_INCORRECT, 79 result_status.FOUND_INCORRECT,
79 result_status.NOT_FOUND_INCORRECT, 80 result_status.NOT_FOUND_INCORRECT,
80 result_status.FOUND_INCORRECT_DUPLICATE): 81 result_status.FOUND_INCORRECT_DUPLICATE):
81 return False 82 return False
82 83
83 return None 84 return None
84 85
86 @property
87 def is_duplicate(self):
lijeffrey 2016/06/27 20:38:22 nit: I would name this just duplicate but this is
88 """Returns whether the analysis result is a duplicate or not.
89
90 Returns:
91 True: duplicate.
92 False: not a duplicate.
93 """
94
95 return self.result_status in (
96 result_status.FOUND_CORRECT_DUPLICATE,
97 result_status.FOUND_INCORRECT_DUPLICATE)
98
85 def Reset(self): # pragma: no cover 99 def Reset(self): # pragma: no cover
86 """Resets to the state as if no analysis is run.""" 100 """Resets to the state as if no analysis is run."""
87 self.pipeline_status_path = None 101 self.pipeline_status_path = None
88 self.status = analysis_status.PENDING 102 self.status = analysis_status.PENDING
89 self.request_time = None 103 self.request_time = None
90 self.start_time = None 104 self.start_time = None
91 self.end_time = None 105 self.end_time = None
92 106
93 @property 107 @property
94 def failure_type(self): 108 def failure_type(self):
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 suspected_cls = ndb.JsonProperty(indexed=False, compressed=True) 160 suspected_cls = ndb.JsonProperty(indexed=False, compressed=True)
147 # Record the id of try job results of each failure. 161 # Record the id of try job results of each failure.
148 failure_result_map = ndb.JsonProperty(indexed=False, compressed=True) 162 failure_result_map = ndb.JsonProperty(indexed=False, compressed=True)
149 163
150 # The actual culprit CLs that are responsible for the failures. 164 # The actual culprit CLs that are responsible for the failures.
151 culprit_cls = ndb.JsonProperty(indexed=False, compressed=True) 165 culprit_cls = ndb.JsonProperty(indexed=False, compressed=True)
152 # Conclusion of analysis result for the build failure: 'Found' or 'Not Found'. 166 # Conclusion of analysis result for the build failure: 'Found' or 'Not Found'.
153 result_status = ndb.IntegerProperty(indexed=True) 167 result_status = ndb.IntegerProperty(indexed=True)
154 # Record the history of triage. 168 # Record the history of triage.
155 triage_history = ndb.JsonProperty(indexed=False, compressed=True) 169 triage_history = ndb.JsonProperty(indexed=False, compressed=True)
170 # An optional reference to the analysis that might have caused this analysis
171 # to be marked as a duplicate.
172 triage_reference_analysis_master_name = ndb.StringProperty(indexed=False)
173 triage_reference_analysis_builder_name = ndb.StringProperty(indexed=False)
174 triage_reference_analysis_build_number = ndb.IntegerProperty(indexed=False)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698