balance_pools.py: Support auto-balancing all boards at once.
Right now, deputies need to manually list all the boards they want to
rebalance. This is a pain for deputies as you need to go copy/paste the
list of boards from the email. Teach balance_pools.py to be capable of
auto-balancing all boards at once.
This is a step towards enabling auto-balancing pools without deputy
intervention (we just need to add heuristics that clarify when we
should auto-balance and when we should not).
BUG=chromium:485403
TEST=Run the script and autobalance all DUTs.
Change-Id: Ifc8945a25d3f4eb9a5d2afd914b80a97befd6ba5
Reviewed-on: https://chromium-review.googlesource.com/269851
Trybot-Ready: David James <davidjames@chromium.org>
Tested-by: David James <davidjames@chromium.org>
Reviewed-by: Prathmesh Prabhu <pprabhu@chromium.org>
Commit-Queue: David James <davidjames@chromium.org>
diff --git a/site_utils/host_label_utils.py b/site_utils/host_label_utils.py
index 2545da5..3a6f21b 100755
--- a/site_utils/host_label_utils.py
+++ b/site_utils/host_label_utils.py
@@ -31,15 +31,16 @@
_HOST_LABEL_TIME_INDEX_TYPE = 'host_labels_time_index'
-def get_all_boards():
+def get_all_boards(labels=None):
"""Get a list of boards from host labels.
Scan through all labels of all duts and get all possible boards based on
label of name board:*
+ @param labels: A list of labels to filter hosts.
@return: A list of board names, e.g., ['peppy', 'daisy']
"""
- host_labels = get_host_labels()
+ host_labels = get_host_labels(labels=labels)
board_labels = [[label[6:] for label in labels
if label.startswith('board:')]
for labels in host_labels.values()]