aboutsummaryrefslogtreecommitdiff
path: root/crosperf
diff options
context:
space:
mode:
authorZhizhou Yang <zhizhouy@google.com>2019-10-14 17:36:09 -0700
committerZhizhou Yang <zhizhouy@google.com>2019-10-15 22:48:08 +0000
commitbf7ee87429d2c9730349ebc22f904b5a3fac7107 (patch)
treeafe85d6bc0535e2d376f6d9be615beffdaed223c /crosperf
parentea5fbd9e6c99d18e002cec6e86bfb889d0820370 (diff)
downloadtoolchain-utils-bf7ee87429d2c9730349ebc22f904b5a3fac7107.tar.gz
toolchain-utils: change naming related to AFE lock
After introducing the new locking mechanism, the behavior of AFELockManager totally changed. This file changed the naming of all related code in toochain-utils. This patch also changed the behavior of locks_dir option, deprecated the use_file_lock option explicitly. TEST=Tested with different DUT types. BUG=chromium:1006434 Change-Id: Ib15efce54ec4d4c5c2a18fecca3f350248462035 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1863530 Reviewed-by: Caroline Tice <cmtice@chromium.org> Reviewed-by: Denis Nikitin <denik@chromium.org> Commit-Queue: Zhizhou Yang <zhizhouy@google.com> Tested-by: Zhizhou Yang <zhizhouy@google.com>
Diffstat (limited to 'crosperf')
-rw-r--r--crosperf/experiment.py3
-rw-r--r--crosperf/experiment_factory.py14
-rw-r--r--crosperf/experiment_runner.py4
-rw-r--r--crosperf/machine_manager.py20
-rw-r--r--crosperf/settings_factory.py10
5 files changed, 28 insertions, 23 deletions
diff --git a/crosperf/experiment.py b/crosperf/experiment.py
index 7a3169b3..1d87b6e4 100644
--- a/crosperf/experiment.py
+++ b/crosperf/experiment.py
@@ -50,9 +50,6 @@ class Experiment(object):
self.num_run_complete = 0
self.share_cache = share_cache
self.active_threads = []
- # If locks_directory (self.lock_dir) not blank, we will use the file
- # locking mechanism; if it is blank then we will use the AFE server
- # locking mechanism.
self.locks_dir = locks_directory
self.locked_machines = []
self.lock_mgr = None
diff --git a/crosperf/experiment_factory.py b/crosperf/experiment_factory.py
index 563f3ac6..5b4d4b0d 100644
--- a/crosperf/experiment_factory.py
+++ b/crosperf/experiment_factory.py
@@ -143,14 +143,20 @@ class ExperimentFactory(object):
config.AddConfig('no_email', global_settings.GetField('no_email'))
share_cache = global_settings.GetField('share_cache')
results_dir = global_settings.GetField('results_dir')
+ # Warn user that option use_file_locks is deprecated.
use_file_locks = global_settings.GetField('use_file_locks')
+ if use_file_locks:
+ l = logger.GetLogger()
+ l.LogWarning('Option use_file_locks is deprecated, please remove it '
+ 'from your experiment settings.')
locks_dir = global_settings.GetField('locks_dir')
- # If we pass a blank locks_dir to the Experiment, it will use the AFE server
- # lock mechanism. So if the user specified use_file_locks, but did not
- # specify a locks dir, set the locks dir to the default locks dir in
+ # If not specified, set the locks dir to the default locks dir in
# file_lock_machine.
- if use_file_locks and not locks_dir:
+ if not locks_dir:
locks_dir = file_lock_machine.Machine.LOCKS_DIR
+ if not os.path.exists(locks_dir):
+ raise RuntimeError('Cannot access default lock directory. '
+ 'Please run prodaccess or specify a local directory')
chrome_src = global_settings.GetField('chrome_src')
show_all_results = global_settings.GetField('show_all_results')
cwp_dso = global_settings.GetField('cwp_dso')
diff --git a/crosperf/experiment_runner.py b/crosperf/experiment_runner.py
index 1bca6b8c..1e2c3142 100644
--- a/crosperf/experiment_runner.py
+++ b/crosperf/experiment_runner.py
@@ -11,7 +11,7 @@ import os
import shutil
import time
-import afe_lock_machine
+import lock_machine
import test_flag
from cros_utils import command_executer
@@ -129,7 +129,7 @@ class ExperimentRunner(object):
self.locked_machines = self._GetMachineList()
experiment.locked_machines = self.locked_machines
else:
- experiment.lock_mgr = afe_lock_machine.AFELockManager(
+ experiment.lock_mgr = lock_machine.LockManager(
self._GetMachineList(),
'',
experiment.labels[0].chromeos_root,
diff --git a/crosperf/machine_manager.py b/crosperf/machine_manager.py
index b9dda148..ea3d105a 100644
--- a/crosperf/machine_manager.py
+++ b/crosperf/machine_manager.py
@@ -1,6 +1,7 @@
# Copyright (c) 2013 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.
+
"""Machine Manager module."""
from __future__ import print_function
@@ -184,10 +185,10 @@ class MachineManager(object):
This class contains methods and calls to lock, unlock and image
machines and distribute machines to each benchmark run. The assumption is
that all of the machines for the experiment have been globally locked
- (using an AFE server) in the ExperimentRunner, but the machines still need
- to be locally locked/unlocked (allocated to benchmark runs) to prevent
- multiple benchmark runs within the same experiment from trying to use the
- same machine at the same time.
+ in the ExperimentRunner, but the machines still need to be locally
+ locked/unlocked (allocated to benchmark runs) to prevent multiple benchmark
+ runs within the same experiment from trying to use the same machine at the
+ same time.
"""
def __init__(self,
@@ -254,7 +255,8 @@ class MachineManager(object):
image_chromeos.__file__, '--no_lock',
'--chromeos_root=%s' % chromeos_root,
'--image=%s' % label.chromeos_image,
- '--image_args=%s' % label.image_args, '--remote=%s' % machine.name,
+ '--image_args=%s' % label.image_args,
+ '--remote=%s' % machine.name,
'--logging_level=%s' % self.log_level
]
if label.board:
@@ -401,10 +403,10 @@ class MachineManager(object):
self.acquire_timeout -= sleep_time
if self.acquire_timeout < 0:
- self.logger.LogFatal(
- 'Could not acquire any of the '
- "following machines: '%s'" % ', '.join(machine.name
- for machine in machines))
+ self.logger.LogFatal('Could not acquire any of the '
+ "following machines: '%s'" % ', '.join(
+ machine.name for machine in machines))
+
### for m in self._machines:
### if (m.locked and time.time() - m.released_time < 10 and
diff --git a/crosperf/settings_factory.py b/crosperf/settings_factory.py
index 1f2693c6..9057703f 100644
--- a/crosperf/settings_factory.py
+++ b/crosperf/settings_factory.py
@@ -202,9 +202,8 @@ class GlobalSettings(Settings):
BooleanField(
'use_file_locks',
default=False,
- description='Whether to use the file locks '
- 'mechanism (deprecated) instead of the AFE '
- 'server lock mechanism.'))
+ description='DEPRECATED: Whether to use the file locks '
+ 'or AFE server lock mechanism.'))
self.AddField(
IntegerField(
'iterations',
@@ -286,8 +285,9 @@ class GlobalSettings(Settings):
'locks_dir',
default='',
description='An alternate directory to use for '
- 'storing/checking machine locks. Using this field '
- 'automatically sets use_file_locks to True.\n'
+ 'storing/checking machine file locks for local machines. '
+ 'By default the file locks directory is '
+ '/google/data/rw/users/mo/mobiletc-prebuild/locks.\n'
'WARNING: If you use your own locks directory, '
'there is no guarantee that someone else might not '
'hold a lock on the same machine in a different '