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

Side by Side Diff: scripts/master/cros/builder_config.py

Issue 1068263003: CrOS: Update public waterfall to auto-configure. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Added experimental/documentation annotations to web UI. Created 5 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 | Annotate | Revision Log
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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 """Utility classes to define and coordinate CrOS Chromite builder display. 5 """Utility classes to define and coordinate CrOS Chromite builder display.
6 """ 6 """
7 7
8 from collections import OrderedDict, namedtuple 8 from collections import OrderedDict, namedtuple
9 9
10 from common.cros_chromite import ChromiteTarget, SlaveType 10 from common.cros_chromite import ChromiteTarget, SlaveType
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 # Default set of class base properties. Subclasses can override these to 43 # Default set of class base properties. Subclasses can override these to
44 # affect behavior. 44 # affect behavior.
45 CLOSER = False 45 CLOSER = False
46 FLOATING = None 46 FLOATING = None
47 UNIQUE = False 47 UNIQUE = False
48 COLLAPSE = True 48 COLLAPSE = True
49 MASTER_BUILDER_NAME = None 49 MASTER_BUILDER_NAME = None
50 SLAVE_TYPE = SlaveType.BAREMETAL 50 SLAVE_TYPE = SlaveType.BAREMETAL
51 SLAVE_CLASS = None 51 SLAVE_CLASS = None
52 CBB_VARIANT = None 52 CBB_VARIANT = None
53 TIMEOUT = None
53 54
54 def __init__(self, config): 55 def __init__(self, config):
55 """Initializes a new configuration. 56 """Initializes a new configuration.
56 57
57 Args: 58 Args:
58 config (ChromiteTarget): The underlying Chromite configuration object. 59 config (ChromiteTarget): The underlying Chromite configuration object.
59 """ 60 """
60 self.config = config 61 self.config = config
61 62
62 def __str__(self): 63 def __str__(self):
(...skipping 26 matching lines...) Expand all
89 @property 90 @property
90 def cbb_variant(self): 91 def cbb_variant(self):
91 """Returns (str): Cbuildbot recipe variant for this builder type, or None. 92 """Returns (str): Cbuildbot recipe variant for this builder type, or None.
92 """ 93 """
93 variant = self.config.category 94 variant = self.config.category
94 if variant and self.config.is_master: 95 if variant and self.config.is_master:
95 return '%s-master' % (variant,) 96 return '%s-master' % (variant,)
96 return variant 97 return variant
97 98
98 @property 99 @property
100 def timeout(self):
101 """Returns (int/None): This builder type's custom build timeout value.
102 """
103 return self.TIMEOUT
104
105 @property
99 def unique(self): 106 def unique(self):
100 """Returns (bool): Whether BuildBot should enforce singleton locks.""" 107 """Returns (bool): Whether BuildBot should enforce singleton locks."""
101 return self.UNIQUE 108 return self.UNIQUE
102 109
103 @property 110 @property
104 def collapse(self): 111 def collapse(self):
105 """Returns (bool): Whether BuildBot should collapse multiple builds. 112 """Returns (bool): Whether BuildBot should collapse multiple builds.
106 113
107 This will be passed to the 'collapseRequests' builder property, and can 114 This will be passed to the 'collapseRequests' builder property, and can
108 either be True, False, or a lambda function (see 115 either be True, False, or a lambda function (see
(...skipping 26 matching lines...) Expand all
135 return self.config['buildbot_waterfall_name'] 142 return self.config['buildbot_waterfall_name']
136 if self.config.is_master: 143 if self.config.is_master:
137 builder_name = self.MASTER_BUILDER_NAME or self._GetBuilderName() 144 builder_name = self.MASTER_BUILDER_NAME or self._GetBuilderName()
138 else: 145 else:
139 builder_name = self._GetBuilderName() 146 builder_name = self._GetBuilderName()
140 return str(builder_name) 147 return str(builder_name)
141 148
142 @property 149 @property
143 def is_experimental(self): 150 def is_experimental(self):
144 """Returns (bool): If this builder is experimental.""" 151 """Returns (bool): If this builder is experimental."""
145 return not (self.config.is_master or self.config.get('important')) 152 return self._IsExperimental()
146 153
147 def _GetBuilderName(self): 154 def _GetBuilderName(self):
148 """Returns (str): Returns the generated builder name. 155 """Returns (str): Returns the generated builder name.
149 156
150 Unless overloaded, the builder name will default to the target configuration 157 Unless overloaded, the builder name will default to the target configuration
151 name. 158 name.
152 """ 159 """
153 return self.config.name 160 return self.config.name
154 161
162 def _IsExperimental(self):
163 """Returns (bool): If this builder is experimental.
164
165 Unless overloaded, a builder is experimental if it's not a master builder or
166 important.
167 """
168 return not (self.config.is_master or self.config.get('important'))
169
155 170
156 class PreCqLauncherBuilderConfig(BuilderConfig): 171 class PreCqLauncherBuilderConfig(BuilderConfig):
157 """BuilderConfig for the Pre-CQ launcher target.""" 172 """BuilderConfig for the Pre-CQ launcher target."""
158 173
159 UNIQUE = True 174 UNIQUE = True
160 CLOSER = True 175 CLOSER = True
161 SLAVE_TYPE = SlaveType.VM 176 SLAVE_TYPE = SlaveType.VM
162 177
163 def _GetBuilderName(self): 178 def _GetBuilderName(self):
164 return 'Pre-CQ Launcher' 179 return 'Pre-CQ Launcher'
(...skipping 12 matching lines...) Expand all
177 192
178 class IncrementalBuilderConfig(BuilderConfig): 193 class IncrementalBuilderConfig(BuilderConfig):
179 """BuilderConfig for Incremental launcher targets.""" 194 """BuilderConfig for Incremental launcher targets."""
180 195
181 CLOSER = True 196 CLOSER = True
182 COLLAPSE = AlwaysCollapseFunc 197 COLLAPSE = AlwaysCollapseFunc
183 198
184 def _GetBuilderName(self): 199 def _GetBuilderName(self):
185 return '%s incremental' % (self.config.base,) 200 return '%s incremental' % (self.config.base,)
186 201
202 def _IsExperimental(self):
203 return False
204
205
206 class FullBuilderConfig(BuilderConfig):
207 """BuilderConfig for Full launcher targets."""
208
209 CLOSER = True
210 COLLAPSE = AlwaysCollapseFunc
211
212 def _GetBuilderName(self):
213 return '%s full' % (self.config.base,)
214
215 def _IsExperimental(self):
216 return False
217
218
219 class AsanBuilderConfig(BuilderConfig):
220 """BuilderConfig for ASAN launcher targets."""
221
222 CLOSER = True
223 COLLAPSE = AlwaysCollapseFunc
224
225 def _GetBuilderName(self):
226 return '%s ASAN' % (self.config.base,)
227
228 def _IsExperimental(self):
229 return False
230
187 231
188 class FirmwareBuilderConfig(BuilderConfig): 232 class FirmwareBuilderConfig(BuilderConfig):
189 """BuilderConfig for Firmware launcher targets.""" 233 """BuilderConfig for Firmware launcher targets."""
190 234
191 def _GetBuilderName(self): 235 def _GetBuilderName(self):
192 return '%s firmware' % (self.config.base,) 236 return '%s firmware' % (self.config.base,)
193 237
194 238
195 class PfqBuilderConfig(BuilderConfig): 239 class PfqBuilderConfig(BuilderConfig):
196 """BuilderConfig for PFQ launcher targets.""" 240 """BuilderConfig for PFQ launcher targets."""
(...skipping 17 matching lines...) Expand all
214 258
215 def _GetBuilderName(self): 259 def _GetBuilderName(self):
216 return '%s canary' % (self.config.base,) 260 return '%s canary' % (self.config.base,)
217 261
218 262
219 class SdkBuilderConfig(BuilderConfig): 263 class SdkBuilderConfig(BuilderConfig):
220 """BuilderConfig for SDK launcher targets.""" 264 """BuilderConfig for SDK launcher targets."""
221 265
222 SLAVE_TYPE = SlaveType.GCE 266 SLAVE_TYPE = SlaveType.GCE
223 COLLAPSE = AlwaysCollapseFunc 267 COLLAPSE = AlwaysCollapseFunc
268 TIMEOUT = 22 * 3600 # 22 Hours.
224 269
225 def _GetBuilderName(self): 270 def _GetBuilderName(self):
226 # Return 'major/minor' (end of toolchain name). 271 # Return 'major/minor' (end of toolchain name).
227 return '%s sdk' % (self.config.base,) 272 return '%s sdk' % (self.config.base,)
228 273
274 def _IsExperimental(self):
275 return False
276
229 277
230 class ToolchainBuilderConfig(BuilderConfig): 278 class ToolchainBuilderConfig(BuilderConfig):
231 """BuilderConfig for toolchain launcher targets. 279 """BuilderConfig for toolchain launcher targets.
232 280
233 Toolchain builders leverage a declared slave class to share slaves between 281 Toolchain builders leverage a declared slave class to share slaves between
234 them. 282 them.
235 """ 283 """
236 284
237 SLAVE_CLASS = 'toolchain' 285 SLAVE_CLASS = 'toolchain'
238 286
(...skipping 12 matching lines...) Expand all
251 # Map of cbuildbot target type to configuration class. 299 # Map of cbuildbot target type to configuration class.
252 # 300 #
253 # This is an ordered dictionary. The order of items corresponds to the 301 # This is an ordered dictionary. The order of items corresponds to the
254 # config type's order on the waterfall. 302 # config type's order on the waterfall.
255 # 303 #
256 # Any configuration type not mapped should default to the 'None' value. 304 # Any configuration type not mapped should default to the 'None' value.
257 CONFIG_MAP = OrderedDict(( 305 CONFIG_MAP = OrderedDict((
258 (ChromiteTarget.PRE_CQ_LAUNCHER, PreCqLauncherBuilderConfig), 306 (ChromiteTarget.PRE_CQ_LAUNCHER, PreCqLauncherBuilderConfig),
259 (ChromiteTarget.PALADIN, PaladinBuilderConfig), 307 (ChromiteTarget.PALADIN, PaladinBuilderConfig),
260 (ChromiteTarget.INCREMENTAL, IncrementalBuilderConfig), 308 (ChromiteTarget.INCREMENTAL, IncrementalBuilderConfig),
309 (ChromiteTarget.FULL, FullBuilderConfig),
310 (ChromiteTarget.ASAN, AsanBuilderConfig),
261 (ChromiteTarget.FIRMWARE, FirmwareBuilderConfig), 311 (ChromiteTarget.FIRMWARE, FirmwareBuilderConfig),
262 (ChromiteTarget.PFQ, PfqBuilderConfig), 312 (ChromiteTarget.PFQ, PfqBuilderConfig),
263 (ChromiteTarget.CANARY, CanaryBuilderConfig), 313 (ChromiteTarget.CANARY, CanaryBuilderConfig),
264 (ChromiteTarget.SDK, SdkBuilderConfig), 314 (ChromiteTarget.SDK, SdkBuilderConfig),
265 (ChromiteTarget.TOOLCHAIN, ToolchainBuilderConfig), 315 (ChromiteTarget.TOOLCHAIN, ToolchainBuilderConfig),
266 (None, BuilderConfig), 316 (None, BuilderConfig),
267 )) 317 ))
268 318
269 # Determine ordinals for each BuilderTarget type. 319 # Determine ordinals for each BuilderTarget type.
270 _config_map_keys = CONFIG_MAP.keys() 320 _config_map_keys = CONFIG_MAP.keys()
(...skipping 14 matching lines...) Expand all
285 """Returns (OrderedDict): BuilderConfig instances for a set of targets. 335 """Returns (OrderedDict): BuilderConfig instances for a set of targets.
286 336
287 Args: 337 Args:
288 targets (list): A list of ChromiteTarget instances to generate 338 targets (list): A list of ChromiteTarget instances to generate
289 BuilderConfigs for. 339 BuilderConfigs for.
290 """ 340 """
291 configs = [GetBuilderConfig(t) 341 configs = [GetBuilderConfig(t)
292 for t in targets.itervalues()] 342 for t in targets.itervalues()]
293 configs.sort() 343 configs.sort()
294 return OrderedDict((c.config.name, c) for c in configs) 344 return OrderedDict((c.config.name, c) for c in configs)
OLDNEW
« no previous file with comments | « scripts/common/unittests/cros_chromite_test.py ('k') | scripts/tools/cros/cros_builder_convert.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698