| OLD | NEW |
| 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 import re | 8 import re |
| 9 | 9 |
| 10 from collections import OrderedDict, namedtuple | 10 from collections import OrderedDict, namedtuple |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 """Represents the presentation of a Chromite builder on a waterfall. | 38 """Represents the presentation of a Chromite builder on a waterfall. |
| 39 | 39 |
| 40 Note that every property here is potentially derivable from the Chromite | 40 Note that every property here is potentially derivable from the Chromite |
| 41 configuration. Information stored in this class should be examined in detail | 41 configuration. Information stored in this class should be examined in detail |
| 42 and, as appropriate, moved into Chromite. | 42 and, as appropriate, moved into Chromite. |
| 43 """ | 43 """ |
| 44 | 44 |
| 45 # Default set of class base properties. Subclasses can override these to | 45 # Default set of class base properties. Subclasses can override these to |
| 46 # affect behavior. | 46 # affect behavior. |
| 47 CLOSER = False | 47 CLOSER = False |
| 48 FLOATING = None | 48 FLOATING = 0 |
| 49 UNIQUE = False | 49 UNIQUE = False |
| 50 COLLAPSE = True | 50 COLLAPSE = True |
| 51 SLAVE_TYPE = SlaveType.BAREMETAL | 51 SLAVE_TYPE = SlaveType.BAREMETAL |
| 52 CBB_VARIANT = None | 52 CBB_VARIANT = None |
| 53 TIMEOUT = None | 53 TIMEOUT = None |
| 54 | 54 |
| 55 def __init__(self, config, branch=None): | 55 def __init__(self, config, branch=None): |
| 56 """Initializes a new configuration. | 56 """Initializes a new configuration. |
| 57 | 57 |
| 58 Args: | 58 Args: |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 """Returns (bool): Whether BuildBot should collapse multiple builds. | 113 """Returns (bool): Whether BuildBot should collapse multiple builds. |
| 114 | 114 |
| 115 This will be passed to the 'collapseRequests' builder property, and can | 115 This will be passed to the 'collapseRequests' builder property, and can |
| 116 either be True, False, or a lambda function (see | 116 either be True, False, or a lambda function (see |
| 117 http://docs.buildbot.net/latest/manual/customization.html). | 117 http://docs.buildbot.net/latest/manual/customization.html). |
| 118 """ | 118 """ |
| 119 return self.COLLAPSE | 119 return self.COLLAPSE |
| 120 | 120 |
| 121 @property | 121 @property |
| 122 def floating(self): | 122 def floating(self): |
| 123 """Returns (bool): Whether this builder should have a floating backup slave. | 123 """Returns (int): The number of floating builders that this builder type |
| 124 should be supported by. |
| 124 """ | 125 """ |
| 125 return self.FLOATING | 126 return self.FLOATING |
| 126 | 127 |
| 127 @property | 128 @property |
| 128 def ordinal(self): | 129 def ordinal(self): |
| 129 """Returns (int): This builder's ordinal (sort order). | 130 """Returns (int): This builder's ordinal (sort order). |
| 130 | 131 |
| 131 This BuilderConfig class' ordinal. This is determined by its position in the | 132 This BuilderConfig class' ordinal. This is determined by its position in the |
| 132 CONFIG_MAP. | 133 CONFIG_MAP. |
| 133 """ | 134 """ |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 | 182 |
| 182 UNIQUE = True | 183 UNIQUE = True |
| 183 CLOSER = True | 184 CLOSER = True |
| 184 SLAVE_TYPE = SlaveType.GCE_WIMPY | 185 SLAVE_TYPE = SlaveType.GCE_WIMPY |
| 185 | 186 |
| 186 | 187 |
| 187 class PaladinBuilderConfig(BuilderConfig): | 188 class PaladinBuilderConfig(BuilderConfig): |
| 188 """BuilderConfig for Paladin launcher targets.""" | 189 """BuilderConfig for Paladin launcher targets.""" |
| 189 | 190 |
| 190 UNIQUE = True | 191 UNIQUE = True |
| 191 FLOATING = 'paladin' | 192 FLOATING = 2 |
| 193 |
| 194 |
| 195 class PfqBuilderConfig(BuilderConfig): |
| 196 """BuilderConfig for Paladin launcher targets.""" |
| 197 |
| 198 UNIQUE = True |
| 199 FLOATING = 2 |
| 192 | 200 |
| 193 | 201 |
| 194 class IncrementalBuilderConfig(BuilderConfig): | 202 class IncrementalBuilderConfig(BuilderConfig): |
| 195 """BuilderConfig for Incremental launcher targets.""" | 203 """BuilderConfig for Incremental launcher targets.""" |
| 196 | 204 |
| 197 CLOSER = True | 205 CLOSER = True |
| 198 COLLAPSE = AlwaysCollapseFunc | 206 COLLAPSE = AlwaysCollapseFunc |
| 199 | 207 |
| 200 def _IsExperimental(self): | 208 def _IsExperimental(self): |
| 201 return False | 209 return False |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 # config type's order on the waterfall. | 272 # config type's order on the waterfall. |
| 265 # | 273 # |
| 266 # Any configuration type not mapped should default to the 'None' value. | 274 # Any configuration type not mapped should default to the 'None' value. |
| 267 CONFIG_MAP = OrderedDict(( | 275 CONFIG_MAP = OrderedDict(( |
| 268 (ChromiteTarget.PRE_CQ_LAUNCHER, PreCqLauncherBuilderConfig), | 276 (ChromiteTarget.PRE_CQ_LAUNCHER, PreCqLauncherBuilderConfig), |
| 269 (ChromiteTarget.PALADIN, PaladinBuilderConfig), | 277 (ChromiteTarget.PALADIN, PaladinBuilderConfig), |
| 270 (ChromiteTarget.INCREMENTAL, IncrementalBuilderConfig), | 278 (ChromiteTarget.INCREMENTAL, IncrementalBuilderConfig), |
| 271 (ChromiteTarget.FULL, FullBuilderConfig), | 279 (ChromiteTarget.FULL, FullBuilderConfig), |
| 272 (ChromiteTarget.ASAN, AsanBuilderConfig), | 280 (ChromiteTarget.ASAN, AsanBuilderConfig), |
| 273 (ChromiteTarget.FIRMWARE, BuilderConfig), | 281 (ChromiteTarget.FIRMWARE, BuilderConfig), |
| 274 (ChromiteTarget.PFQ, BuilderConfig), | 282 (ChromiteTarget.PFQ, PfqBuilderConfig), |
| 275 (ChromiteTarget.PRE_FLIGHT_BRANCH, BuilderConfig), | 283 (ChromiteTarget.PRE_FLIGHT_BRANCH, BuilderConfig), |
| 276 (ChromiteTarget.CANARY, CanaryBuilderConfig), | 284 (ChromiteTarget.CANARY, CanaryBuilderConfig), |
| 277 (ChromiteTarget.SDK, SdkBuilderConfig), | 285 (ChromiteTarget.SDK, SdkBuilderConfig), |
| 278 (ChromiteTarget.TOOLCHAIN, ToolchainBuilderConfig), | 286 (ChromiteTarget.TOOLCHAIN, ToolchainBuilderConfig), |
| 279 (ChromiteTarget.ANDROID_PFQ, BuilderConfig), | 287 (ChromiteTarget.ANDROID_PFQ, BuilderConfig), |
| 280 (None, BuilderConfig), | 288 (None, BuilderConfig), |
| 281 )) | 289 )) |
| 282 | 290 |
| 283 # Determine ordinals for each BuilderTarget type. | 291 # Determine ordinals for each BuilderTarget type. |
| 284 _config_map_keys = CONFIG_MAP.keys() | 292 _config_map_keys = CONFIG_MAP.keys() |
| (...skipping 25 matching lines...) Expand all Loading... |
| 310 | 318 |
| 311 def IsGCESlave(slavename): | 319 def IsGCESlave(slavename): |
| 312 """Returns (bool): Whether |slavename| is hosted on GCE. | 320 """Returns (bool): Whether |slavename| is hosted on GCE. |
| 313 | 321 |
| 314 Args: | 322 Args: |
| 315 slavename: The hostname of the slave. | 323 slavename: The hostname of the slave. |
| 316 """ | 324 """ |
| 317 # The "-c2" suffix indicates that a builder is in GCE (as opposed to | 325 # The "-c2" suffix indicates that a builder is in GCE (as opposed to |
| 318 # in the Chrome Golo, which has a -m2 suffix). | 326 # in the Chrome Golo, which has a -m2 suffix). |
| 319 return bool(re.search(r'-c\d+$', slavename)) | 327 return bool(re.search(r'-c\d+$', slavename)) |
| OLD | NEW |