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

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: Updated from comments. 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 class IncrementalBuilderConfig(BuilderConfig): 185 class IncrementalBuilderConfig(BuilderConfig):
179 """BuilderConfig for Incremental launcher targets.""" 186 """BuilderConfig for Incremental launcher targets."""
180 187
181 CLOSER = True 188 CLOSER = True
182 COLLAPSE = AlwaysCollapseFunc 189 COLLAPSE = AlwaysCollapseFunc
183 190
184 def _GetBuilderName(self): 191 def _GetBuilderName(self):
185 return '%s incremental' % (self.config.base,) 192 return '%s incremental' % (self.config.base,)
186 193
187 194
195 class FullBuilderConfig(BuilderConfig):
196 """BuilderConfig for Full launcher targets."""
197
198 CLOSER = True
199 COLLAPSE = AlwaysCollapseFunc
200
201 def _GetBuilderName(self):
202 return '%s full' % (self.config.base,)
203
204
205 class AsanBuilderConfig(BuilderConfig):
206 """BuilderConfig for ASAN launcher targets."""
207
208 CLOSER = True
209 COLLAPSE = AlwaysCollapseFunc
210
211 def _GetBuilderName(self):
212 return '%s ASAN' % (self.config.base,)
213
214
188 class FirmwareBuilderConfig(BuilderConfig): 215 class FirmwareBuilderConfig(BuilderConfig):
189 """BuilderConfig for Firmware launcher targets.""" 216 """BuilderConfig for Firmware launcher targets."""
190 217
191 def _GetBuilderName(self): 218 def _GetBuilderName(self):
192 return '%s firmware' % (self.config.base,) 219 return '%s firmware' % (self.config.base,)
193 220
194 221
195 class PfqBuilderConfig(BuilderConfig): 222 class PfqBuilderConfig(BuilderConfig):
196 """BuilderConfig for PFQ launcher targets.""" 223 """BuilderConfig for PFQ launcher targets."""
197 224
(...skipping 16 matching lines...) Expand all
214 241
215 def _GetBuilderName(self): 242 def _GetBuilderName(self):
216 return '%s canary' % (self.config.base,) 243 return '%s canary' % (self.config.base,)
217 244
218 245
219 class SdkBuilderConfig(BuilderConfig): 246 class SdkBuilderConfig(BuilderConfig):
220 """BuilderConfig for SDK launcher targets.""" 247 """BuilderConfig for SDK launcher targets."""
221 248
222 SLAVE_TYPE = SlaveType.GCE 249 SLAVE_TYPE = SlaveType.GCE
223 COLLAPSE = AlwaysCollapseFunc 250 COLLAPSE = AlwaysCollapseFunc
251 TIMEOUT = 22 * 3600 # 22 Hours.
224 252
225 def _GetBuilderName(self): 253 def _GetBuilderName(self):
226 # Return 'major/minor' (end of toolchain name). 254 # Return 'major/minor' (end of toolchain name).
227 return '%s sdk' % (self.config.base,) 255 return '%s sdk' % (self.config.base,)
228 256
229 257
230 class ToolchainBuilderConfig(BuilderConfig): 258 class ToolchainBuilderConfig(BuilderConfig):
231 """BuilderConfig for toolchain launcher targets. 259 """BuilderConfig for toolchain launcher targets.
232 260
233 Toolchain builders leverage a declared slave class to share slaves between 261 Toolchain builders leverage a declared slave class to share slaves between
(...skipping 17 matching lines...) Expand all
251 # Map of cbuildbot target type to configuration class. 279 # Map of cbuildbot target type to configuration class.
252 # 280 #
253 # This is an ordered dictionary. The order of items corresponds to the 281 # This is an ordered dictionary. The order of items corresponds to the
254 # config type's order on the waterfall. 282 # config type's order on the waterfall.
255 # 283 #
256 # Any configuration type not mapped should default to the 'None' value. 284 # Any configuration type not mapped should default to the 'None' value.
257 CONFIG_MAP = OrderedDict(( 285 CONFIG_MAP = OrderedDict((
258 (ChromiteTarget.PRE_CQ_LAUNCHER, PreCqLauncherBuilderConfig), 286 (ChromiteTarget.PRE_CQ_LAUNCHER, PreCqLauncherBuilderConfig),
259 (ChromiteTarget.PALADIN, PaladinBuilderConfig), 287 (ChromiteTarget.PALADIN, PaladinBuilderConfig),
260 (ChromiteTarget.INCREMENTAL, IncrementalBuilderConfig), 288 (ChromiteTarget.INCREMENTAL, IncrementalBuilderConfig),
289 (ChromiteTarget.FULL, FullBuilderConfig),
290 (ChromiteTarget.ASAN, AsanBuilderConfig),
261 (ChromiteTarget.FIRMWARE, FirmwareBuilderConfig), 291 (ChromiteTarget.FIRMWARE, FirmwareBuilderConfig),
262 (ChromiteTarget.PFQ, PfqBuilderConfig), 292 (ChromiteTarget.PFQ, PfqBuilderConfig),
263 (ChromiteTarget.CANARY, CanaryBuilderConfig), 293 (ChromiteTarget.CANARY, CanaryBuilderConfig),
264 (ChromiteTarget.SDK, SdkBuilderConfig), 294 (ChromiteTarget.SDK, SdkBuilderConfig),
265 (ChromiteTarget.TOOLCHAIN, ToolchainBuilderConfig), 295 (ChromiteTarget.TOOLCHAIN, ToolchainBuilderConfig),
266 (None, BuilderConfig), 296 (None, BuilderConfig),
267 )) 297 ))
268 298
269 # Determine ordinals for each BuilderTarget type. 299 # Determine ordinals for each BuilderTarget type.
270 _config_map_keys = CONFIG_MAP.keys() 300 _config_map_keys = CONFIG_MAP.keys()
(...skipping 14 matching lines...) Expand all
285 """Returns (OrderedDict): BuilderConfig instances for a set of targets. 315 """Returns (OrderedDict): BuilderConfig instances for a set of targets.
286 316
287 Args: 317 Args:
288 targets (list): A list of ChromiteTarget instances to generate 318 targets (list): A list of ChromiteTarget instances to generate
289 BuilderConfigs for. 319 BuilderConfigs for.
290 """ 320 """
291 configs = [GetBuilderConfig(t) 321 configs = [GetBuilderConfig(t)
292 for t in targets.itervalues()] 322 for t in targets.itervalues()]
293 configs.sort() 323 configs.sort()
294 return OrderedDict((c.config.name, c) for c in configs) 324 return OrderedDict((c.config.name, c) for c in configs)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698