diff options
Diffstat (limited to 'utils/locks.py')
-rw-r--r-- | utils/locks.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/utils/locks.py b/utils/locks.py index f846764b..641fe006 100644 --- a/utils/locks.py +++ b/utils/locks.py @@ -1,10 +1,7 @@ -#!/usr/bin/python # Copyright 2015 The Chromium OS Authors. All rights reserved. - """Utilities for locking machines.""" - import os import sys import time @@ -19,7 +16,7 @@ def AcquireLock(machines, chromeos_root, timeout=1200): """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) + sleep_time = min(10, timeout / 10.0) while True: try: afe_lock_machine.AFELockManager(machines, False, chromeos_root, @@ -29,8 +26,9 @@ def AcquireLock(machines, chromeos_root, timeout=1200): if time.time() - start_time > timeout: locked = False logger.GetLogger().LogWarning( - "Could not acquire lock on this machine: {0} within {1} seconds. %s" - .format(repr(machines), timeout, str(e))) + 'Could not acquire lock on this machine: {0} within {1} seconds. %s' + .format( + repr(machines), timeout, str(e))) break time.sleep(sleep_time) return locked @@ -44,6 +42,6 @@ def ReleaseLock(machines, chromeos_root): None).UpdateMachines(False) except Exception as e: unlocked = False - logger.GetLogger().LogWarning("Could not unlock %s. %s" % + logger.GetLogger().LogWarning('Could not unlock %s. %s' % (repr(machines), str(e))) return unlocked |