Chromium Code Reviews| OLD | NEW |
|---|---|
| 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.flake.master_flake_analysis import MasterFlakeAnalysis | 7 from model.flake.master_flake_analysis import MasterFlakeAnalysis |
| 8 from model.versioned_model import VersionedModel | 8 from model.versioned_model import VersionedModel |
| 9 | 9 |
| 10 | 10 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 return True | 121 return True |
| 122 | 122 |
| 123 def CopyFrom(self, other): | 123 def CopyFrom(self, other): |
| 124 """Copies all states from the given request.""" | 124 """Copies all states from the given request.""" |
| 125 assert isinstance(other, FlakeAnalysisRequest) | 125 assert isinstance(other, FlakeAnalysisRequest) |
| 126 self.is_step = other.is_step | 126 self.is_step = other.is_step |
| 127 self.bug_id = other.bug_id | 127 self.bug_id = other.bug_id |
| 128 self.user_emails = other.user_emails | 128 self.user_emails = other.user_emails |
| 129 self.build_steps = other.build_steps | 129 self.build_steps = other.build_steps |
| 130 self.analyses = other.analyses | 130 self.analyses = other.analyses |
| 131 | |
| 132 def _GetNormalizedConfigurationNames(self, master_name, builder_name): | |
| 133 for build_step in self.build_steps: | |
| 134 if ((build_step.master_name == master_name and | |
| 135 build_step.builder_name == builder_name) or | |
| 136 (build_step.wf_master_name == master_name and | |
| 137 build_step.wf_builder_name == builder_name)): | |
| 138 return build_step.wf_master_name, build_step.wf_builder_name | |
| 139 return None, None | |
| 140 | |
| 141 def FindMatchingAnalysisForConfiguration(self, master_name, builder_name): | |
| 142 # Returns the analysis that corresponds to the requested master and builder. | |
| 143 normalized_master_name, normalized_builder_name = ( | |
| 144 self._GetNormalizedConfigurationNames(master_name, builder_name)) | |
| 145 | |
| 146 if not normalized_master_name or not normalized_builder_name: | |
|
chanli
2016/11/18 21:02:46
Essentially _GetNormalizedConfigurationNames will
lijeffrey
2016/11/19 01:00:25
Not necessarily, build_step.master_name might != b
| |
| 147 return None | |
| 148 | |
| 149 for analysis_key in self.analyses: | |
| 150 components = analysis_key.pairs()[0][1].split('/') | |
|
stgao
2016/11/18 21:03:00
How about moving this logic to the MasterFlakeAnal
lijeffrey
2016/11/19 01:00:25
Done.
| |
| 151 analysis_master_name = components[0] | |
| 152 analysis_builder_name = components[1] | |
| 153 | |
| 154 if (analysis_master_name == normalized_master_name and | |
| 155 analysis_builder_name == normalized_builder_name): | |
| 156 return analysis_key.get() | |
| 157 | |
| 158 return None | |
| OLD | NEW |