| 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 gae_libs.model.versioned_model import VersionedModel | 7 from gae_libs.model.versioned_model import VersionedModel |
| 8 from model.flake.master_flake_analysis import MasterFlakeAnalysis | 8 from model.flake.master_flake_analysis import MasterFlakeAnalysis |
| 9 | 9 |
| 10 | 10 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 self.is_step = other.is_step | 131 self.is_step = other.is_step |
| 132 self.bug_id = other.bug_id | 132 self.bug_id = other.bug_id |
| 133 self.user_emails = other.user_emails | 133 self.user_emails = other.user_emails |
| 134 self.build_steps = other.build_steps | 134 self.build_steps = other.build_steps |
| 135 self.analyses = other.analyses | 135 self.analyses = other.analyses |
| 136 | 136 |
| 137 @property | 137 @property |
| 138 def on_cq(self): | 138 def on_cq(self): |
| 139 """Returns True if the flake is on Commit Queue.""" | 139 """Returns True if the flake is on Commit Queue.""" |
| 140 return any(step.on_cq for step in self.build_steps) | 140 return any(step.on_cq for step in self.build_steps) |
| 141 |
| 142 def _GetNormalizedConfigurationNames(self, master_name, builder_name): |
| 143 for build_step in self.build_steps: |
| 144 if ((build_step.master_name == master_name and |
| 145 build_step.builder_name == builder_name) or |
| 146 (build_step.wf_master_name == master_name and |
| 147 build_step.wf_builder_name == builder_name)): |
| 148 return build_step.wf_master_name, build_step.wf_builder_name |
| 149 return None, None |
| 150 |
| 151 def FindMatchingAnalysisForConfiguration(self, master_name, builder_name): |
| 152 # Returns the analysis that corresponds to the requested master and builder. |
| 153 normalized_master_name, normalized_builder_name = ( |
| 154 self._GetNormalizedConfigurationNames(master_name, builder_name)) |
| 155 |
| 156 if not normalized_master_name or not normalized_builder_name: |
| 157 return None |
| 158 |
| 159 for analysis_key in self.analyses: |
| 160 analysis_master_name, analysis_builder_name = ( |
| 161 MasterFlakeAnalysis.GetBuildConfigurationFromKey(analysis_key)) |
| 162 |
| 163 if (analysis_master_name == normalized_master_name and |
| 164 analysis_builder_name == normalized_builder_name): |
| 165 return analysis_key.get() |
| 166 |
| 167 return None |
| OLD | NEW |