aboutsummaryrefslogtreecommitdiff
path: root/crosperf/machine_image_manager.py
diff options
context:
space:
mode:
authorZhizhou Yang <zhizhouy@google.com>2017-07-22 01:11:35 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-07-22 01:11:35 +0000
commitddfea1f7e75062a350bd5a9418562e3b5af5b6e9 (patch)
treebf139ee25415cecde142e95791edba3803b2452a /crosperf/machine_image_manager.py
parent3690e025de8daaed03c4acb02d2b054e5c4c0dd5 (diff)
parent6c551e0d526de7de9d86516614d645cba6f975a6 (diff)
downloadtoolchain-utils-ddfea1f7e75062a350bd5a9418562e3b5af5b6e9.tar.gz
Merge branch 'aosp/mirror-chromium-master' into update_utils am: 4307f4735e am: 18caef1eddandroid-o-mr1-iot-preview-6o-mr1-iot-preview-6
am: 6c551e0d52 Change-Id: I44720cd3cd736bb61f583fb20df1c25ac9323ae0
Diffstat (limited to 'crosperf/machine_image_manager.py')
-rw-r--r--crosperf/machine_image_manager.py42
1 files changed, 20 insertions, 22 deletions
diff --git a/crosperf/machine_image_manager.py b/crosperf/machine_image_manager.py
index 3cc464bb..2ad750d3 100644
--- a/crosperf/machine_image_manager.py
+++ b/crosperf/machine_image_manager.py
@@ -1,10 +1,9 @@
-
# Copyright 2015 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-
"""MachineImageManager allocates images to duts."""
+
class MachineImageManager(object):
"""Management of allocating images to duts.
@@ -132,8 +131,7 @@ class MachineImageManager(object):
* Special / common case to handle seperately
We have only 1 dut or if we have only 1 label, that's simple enough.
-
- """
+ """
def __init__(self, labels, duts):
self.labels_ = labels
@@ -158,13 +156,13 @@ class MachineImageManager(object):
def compute_initial_allocation(self):
"""Compute the initial label-dut allocation.
- This method finds the most efficient way that every label gets imaged at
- least once.
+ This method finds the most efficient way that every label gets imaged at
+ least once.
- Returns:
- False, only if not all labels could be imaged to a certain machine,
- otherwise True.
- """
+ Returns:
+ False, only if not all labels could be imaged to a certain machine,
+ otherwise True.
+ """
if self.n_duts_ == 1:
for i, v in self.matrix_vertical_generator(0):
@@ -196,15 +194,15 @@ class MachineImageManager(object):
def allocate(self, dut, schedv2=None):
"""Allocate a label for dut.
- Args:
- dut: the dut that asks for a new image.
- schedv2: the scheduling instance, we need the benchmark run
- information with schedv2 for a better allocation.
+ Args:
+ dut: the dut that asks for a new image.
+ schedv2: the scheduling instance, we need the benchmark run
+ information with schedv2 for a better allocation.
- Returns:
- a label to image onto the dut or None if no more available images for
- the dut.
- """
+ Returns:
+ a label to image onto the dut or None if no more available images for
+ the dut.
+ """
j = self.dut_name_ordinal_[dut.name]
# 'can_' prefix means candidate label's.
can_reimage_number = 999
@@ -270,16 +268,16 @@ class MachineImageManager(object):
def matrix_vertical_generator(self, col):
"""Iterate matrix vertically at column 'col'.
- Yield row number i and value at matrix_[i][col].
- """
+ Yield row number i and value at matrix_[i][col].
+ """
for i, _ in enumerate(self.labels_):
yield i, self.matrix_[i][col]
def matrix_horizontal_generator(self, row):
"""Iterate matrix horizontally at row 'row'.
- Yield col number j and value at matrix_[row][j].
- """
+ Yield col number j and value at matrix_[row][j].
+ """
for j, _ in enumerate(self.duts_):
yield j, self.matrix_[row][j]