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

Side by Side Diff: appengine/findit/model/flake/flake_analysis_request.py

Issue 2510223003: [Findit] Fixing analysis mismatch in check flake (Closed)
Patch Set: 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 import logging
6
5 from google.appengine.ext import ndb 7 from google.appengine.ext import ndb
6 8
7 from model.flake.master_flake_analysis import MasterFlakeAnalysis 9 from model.flake.master_flake_analysis import MasterFlakeAnalysis
8 from model.versioned_model import VersionedModel 10 from model.versioned_model import VersionedModel
9 11
10 12
11 class BuildStep(ndb.Model): 13 class BuildStep(ndb.Model):
12 """Represents a build step on Waterfall or Commit Queue. 14 """Represents a build step on Waterfall or Commit Queue.
13 15
14 For a build step on Commit Queue, the matching Waterfall build step could be 16 For a build step on Commit Queue, the matching Waterfall build step could be
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 return True 123 return True
122 124
123 def CopyFrom(self, other): 125 def CopyFrom(self, other):
124 """Copies all states from the given request.""" 126 """Copies all states from the given request."""
125 assert isinstance(other, FlakeAnalysisRequest) 127 assert isinstance(other, FlakeAnalysisRequest)
126 self.is_step = other.is_step 128 self.is_step = other.is_step
127 self.bug_id = other.bug_id 129 self.bug_id = other.bug_id
128 self.user_emails = other.user_emails 130 self.user_emails = other.user_emails
129 self.build_steps = other.build_steps 131 self.build_steps = other.build_steps
130 self.analyses = other.analyses 132 self.analyses = other.analyses
133
134 def _GetNormalizedConfigurationNames(self, master_name, builder_name):
135 for build_step in self.build_steps:
136 if ((build_step.master_name == master_name and
137 build_step.builder_name == builder_name) or
138 (build_step.wf_master_name == master_name and
139 build_step.wf_builder_name == builder_name)):
140 return build_step.wf_master_name, build_step.wf_builder_name
141 return None, None
142
143 def FindMatchingAnalysisForConfiguration(self, master_name, builder_name):
144 normalized_master_name, normalized_builder_name = (
145 self._GetNormalizedConfigurationNames(master_name, builder_name))
146
147 if not normalized_builder_name or not normalized_master_name:
148 return None
149
150 for analysis_key in self.analyses:
151 analysis = analysis_key.get()
stgao 2016/11/18 17:33:42 Based on the key, we could derive master/builder n
lijeffrey 2016/11/18 20:47:33 Done.
152
153 if not analysis: # pragma: no cover
154 logging.error('Analysis was deleted unexpectedly!')
155 return None
chanli 2016/11/18 19:15:28 If one analysis is deleted, I agree we should log
lijeffrey 2016/11/18 20:47:33 Done.
156 if (analysis.master_name == normalized_master_name and
157 analysis.builder_name == normalized_builder_name):
158 return analysis
159
160 return None
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698