Index: masters/master.client.v8/slaves.cfg |
diff --git a/masters/master.client.v8/slaves.cfg b/masters/master.client.v8/slaves.cfg |
index 5f7f930a1fddb108437c653e8d807eb732ca7a48..814c62009ab0bfbeffd7b0dfa43d0c923a6e58ae 100644 |
--- a/masters/master.client.v8/slaves.cfg |
+++ b/masters/master.client.v8/slaves.cfg |
@@ -40,7 +40,6 @@ slaves = [ |
{ |
'master': 'V8', |
'builder': ['V8 Linux - builder', |
- 'V8 Linux - swarming staging builder', |
'V8 Linux - debug builder'], |
'hostname': 'vm362-m3', |
'os': 'linux', |
@@ -191,7 +190,7 @@ slaves = [ |
}, |
{ |
'master': 'V8', |
- 'builder': ['V8 Linux64 - cfi', 'V8 Linux - swarming staging 3'], |
+ 'builder': ['V8 Linux64 - cfi', 'V8 Linux - swarming staging'], |
'hostname': 'slave80-c3', |
'os': 'linux', |
'version': 'precise', |
@@ -396,66 +395,50 @@ for vm in [631, 632, 633]: |
'bits': '64', |
}) |
-for j in xrange(3): |
- slaves.append({ |
- 'master': 'V8', |
- 'builder': ['V8 Linux - swarming staging 1', |
- 'V8 Linux - swarming staging 2'], |
- 'hostname': 'slave83-c3', |
- 'os': 'linux', |
- 'version': 'precise', |
- 'bits': '64', |
- 'subdir': str(j), |
- }) |
+def distribute_subdir_slaves(builders, hostnames): |
+ """Distributes a list of builders to a list of hostnames with subdirs. |
-# TODO(machenbach): Refactor usage of subdir slaves. Make it easier to |
-# map builders to subdir slaves from a pool. |
-slaves.append({ |
- 'master': 'V8', |
- 'builder': ['V8 Arm'], |
- 'hostname': 'slave83-c3', |
- 'os': 'linux', |
- 'version': 'precise', |
- 'bits': '64', |
- 'subdir': str(3), |
-}) |
+ Each builder will be assigned to one (subdir) slave. The different hosts will |
+ have an equal number (+/- 1) of subdir slaves. |
-slaves.append({ |
- 'master': 'V8', |
- 'builder': ['V8 Arm - debug'], |
- 'hostname': 'slave83-c3', |
- 'os': 'linux', |
- 'version': 'precise', |
- 'bits': '64', |
- 'subdir': str(4), |
-}) |
+ Example: Distributing builders [A, B, C, D, E] to slaves [X, Y] will result |
+ in [AX0, BY0, CX1, DY1, EX2], where e.g. CX1 is builder C on host X with |
+ subdir 1. |
+ """ |
+ # Assuming lists are used to ensure determinism. |
+ assert type(builders) == list |
+ assert type(hostnames) == list |
-slaves.append({ |
- 'master': 'V8', |
- 'builder': ['V8 Arm GC Stress'], |
- 'hostname': 'slave83-c3', |
- 'os': 'linux', |
- 'version': 'precise', |
- 'bits': '64', |
- 'subdir': str(5), |
-}) |
+ # Assuming there are more or equal builders than hostnames. |
+ assert len(builders) >= len(hostnames) |
-slaves.append({ |
- 'master': 'V8', |
- 'builder': ['V8 Win32'], |
- 'hostname': 'slave83-c3', |
- 'os': 'linux', |
- 'version': 'precise', |
- 'bits': '64', |
- 'subdir': str(6), |
-}) |
+ subdir_index = 0 |
+ hostname_index = 0 |
+ for builder in builders: |
+ if hostname_index >= len(hostnames): |
+ # All hostnames were used, rotate and advance the subdir index. |
+ hostname_index = 0 |
+ subdir_index += 1 |
+ slaves.append({ |
+ 'master': 'V8', |
+ 'builder': builder, |
+ 'hostname': hostnames[hostname_index], |
+ 'os': 'linux', |
+ 'version': 'precise', |
+ 'bits': '64', |
+ 'subdir': str(subdir_index), |
+ }) |
+ hostname_index += 1 |
-slaves.append({ |
- 'master': 'V8', |
- 'builder': ['V8 Win32 - debug'], |
- 'hostname': 'slave83-c3', |
- 'os': 'linux', |
- 'version': 'precise', |
- 'bits': '64', |
- 'subdir': str(7), |
-}) |
+distribute_subdir_slaves( |
+ [ |
+ 'V8 Arm', |
+ 'V8 Arm - debug', |
+ 'V8 Arm GC Stress', |
+ 'V8 Win32', |
+ 'V8 Win32 - debug', |
+ ], |
+ [ |
+ 'slave83-c3', |
+ ], |
+) |