diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2020-04-28 20:24:56 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2020-04-28 20:24:56 +0000 |
commit | 656c7c0fa0d9b776c019f5423e01a9a28979d2bd (patch) | |
tree | 220a95d346d58fa5090d8033991bcfef2ad03d99 /cros_utils/locks.py | |
parent | 091406baac88deeb2ef9c71d5047bd9daf3915ef (diff) | |
parent | ccead650bb8e050400f55dc44b60f989b1f8e117 (diff) | |
download | toolchain-utils-q_tzdata_aml_297100000.tar.gz |
Snap for 6439596 from ccead650bb8e050400f55dc44b60f989b1f8e117 to qt-aml-tzdata-releaseq_tzdata_aml_297100400q_tzdata_aml_297100300q_tzdata_aml_297100000q_tzdata_aml_296200000q_tzdata_aml_295600118q_tzdata_aml_295600110q_tzdata_aml_295500002q_tzdata_aml_295500001q_tzdata_aml_294400310android-mainline-12.0.0_r54android-mainline-12.0.0_r111android-mainline-10.0.0_r13android-mainline-10.0.0_r12android-mainline-10.0.0_r11q_tzdata_aml_297100000android12-mainline-tzdata-releaseandroid10-mainline-tzdata-releaseandroid10-android13-mainline-tzdata-release
Change-Id: I3464301d9b41d48e11dfd361a411d60a1bd5a429
Diffstat (limited to 'cros_utils/locks.py')
-rw-r--r-- | cros_utils/locks.py | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/cros_utils/locks.py b/cros_utils/locks.py index 4ecbe0a9..cb96368e 100644 --- a/cros_utils/locks.py +++ b/cros_utils/locks.py @@ -1,29 +1,24 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2019 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. - +# Copyright 2015 The Chromium OS Authors. All rights reserved. """Utilities for locking machines.""" from __future__ import print_function import time -import lock_machine +import afe_lock_machine import logger def AcquireLock(machines, chromeos_root, timeout=1200): - """Acquire lock for machine(s) with timeout.""" + """Acquire lock for machine(s) with timeout, using AFE server for locking.""" start_time = time.time() locked = True sleep_time = min(10, timeout / 10.0) while True: try: - lock_machine.LockManager(machines, False, - chromeos_root).UpdateMachines(True) + afe_lock_machine.AFELockManager(machines, False, chromeos_root, + None).UpdateMachines(True) break except Exception as e: if time.time() - start_time > timeout: @@ -37,13 +32,13 @@ def AcquireLock(machines, chromeos_root, timeout=1200): def ReleaseLock(machines, chromeos_root): - """Release locked machine(s).""" + """Release locked machine(s), using AFE server for locking.""" unlocked = True try: - lock_machine.LockManager(machines, False, - chromeos_root).UpdateMachines(False) + afe_lock_machine.AFELockManager(machines, False, chromeos_root, + None).UpdateMachines(False) except Exception as e: unlocked = False - logger.GetLogger().LogWarning( - 'Could not unlock %s. %s' % (repr(machines), str(e))) + logger.GetLogger().LogWarning('Could not unlock %s. %s' % + (repr(machines), str(e))) return unlocked |