pass
msg = f'Could not acquire {self.lockfile}.'
logger.warning(msg)
- warnings.warn(msg)
return False
def acquire_with_retries(
return self
msg = f"Couldn't acquire {self.lockfile}; giving up."
logger.warning(msg)
- warnings.warn(msg)
raise LockFileException(msg)
def __exit__(self, type, value, traceback):
cmd = self.override_command
else:
cmd = ' '.join(sys.argv)
- print(cmd)
contents = LockFileContents(
pid = os.getpid(),
commandline = cmd,
except OSError:
msg = f'Lockfile {self.lockfile}\'s pid ({contents.pid}) is stale; force acquiring'
logger.warning(msg)
- warnings.warn(msg)
self.release()
# Has the lock expiration expired?
if now > contents.expiration_datetime:
msg = f'Lockfile {self.lockfile} expiration time has passed; force acquiring'
logger.warning(msg)
- warnings.warn(msg)
self.release()
except Exception:
pass