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

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

Issue 1886673002: [Findit] Differentiate compile failures and test failures. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 4 years, 8 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
8 from common.waterfall import failure_type
7 from model.base_build_model import BaseBuildModel 9 from model.base_build_model import BaseBuildModel
8 from model import analysis_status 10 from model import analysis_status
9 from model import result_status 11 from model import result_status
10 12
11 13
12 class WfAnalysis(BaseBuildModel): 14 class WfAnalysis(BaseBuildModel):
13 """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.
14 16
15 'Wf' is short for waterfall. 17 'Wf' is short for waterfall.
16 """ 18 """
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 return None 83 return None
82 84
83 def Reset(self): # pragma: no cover 85 def Reset(self): # pragma: no cover
84 """Resets to the state as if no analysis is run.""" 86 """Resets to the state as if no analysis is run."""
85 self.pipeline_status_path = None 87 self.pipeline_status_path = None
86 self.status = analysis_status.PENDING 88 self.status = analysis_status.PENDING
87 self.request_time = None 89 self.request_time = None
88 self.start_time = None 90 self.start_time = None
89 self.end_time = None 91 self.end_time = None
90 92
93 @property
94 def failure_type(self):
95 if self.build_failure_type is not None:
96 return self.build_failure_type
97
98 # Legacy data don't have property ``build_failure_type``.
99 if not self.result:
100 return failure_type.UNKNOWN
101
102 step_failures = self.result.get('failures', [])
103 if not step_failures:
104 return failure_type.UNKNOWN
105
106 for step_result in step_failures:
107 if step_result['step_name'] == constants.COMPILE_STEP_NAME:
108 return failure_type.COMPILE
109
110 # Although the failed steps could be infra setup steps like "bot_update",
111 # for legacy data we just assume all of them are tests if not compile.
112 return failure_type.TEST
113
91 # When the build cycle started. 114 # When the build cycle started.
92 build_start_time = ndb.DateTimeProperty(indexed=True) 115 build_start_time = ndb.DateTimeProperty(indexed=True)
116 # Whether the build cycle has completed.
93 build_completed = ndb.BooleanProperty(indexed=False) 117 build_completed = ndb.BooleanProperty(indexed=False)
118 # Whether it is a compile failure, test failure, infra failure or others.
119 # Refer to common/waterfall/failure_type.py for all the failure types.
120 build_failure_type = ndb.IntegerProperty(indexed=False)
94 121
95 # The url path to the pipeline status page. 122 # The url path to the pipeline status page.
96 pipeline_status_path = ndb.StringProperty(indexed=False) 123 pipeline_status_path = ndb.StringProperty(indexed=False)
97 # The status of the analysis. 124 # The status of the analysis.
98 status = ndb.IntegerProperty( 125 status = ndb.IntegerProperty(
99 default=analysis_status.PENDING, indexed=False) 126 default=analysis_status.PENDING, indexed=False)
100 # When the analysis was requested. 127 # When the analysis was requested.
101 request_time = ndb.DateTimeProperty(indexed=False) 128 request_time = ndb.DateTimeProperty(indexed=False)
102 # When the analysis actually started. 129 # When the analysis actually started.
103 start_time = ndb.DateTimeProperty(indexed=False) 130 start_time = ndb.DateTimeProperty(indexed=False)
(...skipping 11 matching lines...) Expand all
115 suspected_cls = ndb.JsonProperty(indexed=False, compressed=True) 142 suspected_cls = ndb.JsonProperty(indexed=False, compressed=True)
116 # Record the id of try job results of each failure. 143 # Record the id of try job results of each failure.
117 failure_result_map = ndb.JsonProperty(indexed=False, compressed=True) 144 failure_result_map = ndb.JsonProperty(indexed=False, compressed=True)
118 145
119 # The actual culprit CLs that are responsible for the failures. 146 # The actual culprit CLs that are responsible for the failures.
120 culprit_cls = ndb.JsonProperty(indexed=False, compressed=True) 147 culprit_cls = ndb.JsonProperty(indexed=False, compressed=True)
121 # Conclusion of analysis result for the build failure: 'Found' or 'Not Found'. 148 # Conclusion of analysis result for the build failure: 'Found' or 'Not Found'.
122 result_status = ndb.IntegerProperty(indexed=True) 149 result_status = ndb.IntegerProperty(indexed=True)
123 # Record the history of triage. 150 # Record the history of triage.
124 triage_history = ndb.JsonProperty(indexed=False, compressed=True) 151 triage_history = ndb.JsonProperty(indexed=False, compressed=True)
OLDNEW
« no previous file with comments | « appengine/findit/model/test/wf_analysis_test.py ('k') | appengine/findit/waterfall/detect_first_failure_pipeline.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698