| # Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import chromiumos_board_config |
| |
| from common.cros_chromite import ChromiteTarget |
| from common.cros_chromite import SlaveType |
| |
| # Use the SlaveAlloctor declared in 'board_config'. |
| sa = chromiumos_board_config.slave_allocator |
| sa.LoadState(enforce=False) |
| |
| def shared(slave_type): |
| return '%s_shared' % (slave_type,) |
| |
| # Baremetal slaves |
| sa.AddPool(SlaveType.BAREMETAL, *('build%s-m2' % (n,) for n in set([ |
| 85, 86, 87, 92, 112, 162, 174, 182, 203, 257, 258, 317, 263, 323, 326, |
| 333, |
| ]) - set([ |
| # Decommissioned slaves (please include bug so we can re-include when Fixed). |
| 91, # crbug.com/606427 |
| 257, # crbug.com/635304 |
| ]))) |
| |
| # GCE slaves |
| sa.AddPool(SlaveType.GCE, *('cros%s-c2' % (n,) for n in ( |
| 199, |
| ))) |
| |
| # Baremetal shared slave pool (e.g., build123-m2) |
| sa.AddPool(shared(SlaveType.BAREMETAL), *('build%s-m2' % (n,) for n in set([ |
| 84, 94 |
| ]) - set([ |
| # Decommissioned slaves (please include bug so we can re-include when Fixed). |
| ]))) |
| |
| for board_config in chromiumos_board_config.builder_configs.itervalues(): |
| name = board_config.config.name |
| if board_config.config.category in ( |
| ChromiteTarget.REFRESH_PACKAGES, |
| ChromiteTarget.ASAN, |
| ): |
| sa.Join( |
| name, |
| sa.Alloc( |
| 'builder_shared', |
| pools=[shared(board_config.slave_type)], |
| exclusive=False, |
| subtype=name)) |
| else: |
| sa.Join( |
| name, |
| sa.Alloc( |
| 'builder', |
| pools=[board_config.slave_type], |
| exclusive=True, |
| subtype=name)) |
| |
| # If the board requires a floating builder, add that. |
| if board_config.floating: |
| sa.Join( |
| name, |
| sa.Alloc( |
| 'floating', |
| subtype=board_config.config.category, |
| pools=[board_config.slave_type], |
| count=board_config.floating, |
| exclusive=True)) |
| |
| def GenSlave(hostname, config_names): |
| return { |
| 'master': 'ChromiumOS', |
| 'builder': [chromiumos_board_config.builder_configs[c].builder_name |
| for c in config_names], |
| 'hostname': str(hostname), |
| 'os': 'linux', |
| 'version': 'precise', |
| } |
| |
| slaves = [] |
| slave_map = sa.GetSlaveMap() |
| for hostname, entry in slave_map.entries.iteritems(): |
| slaves.append(GenSlave(hostname, entry.keys)) |