projects
/
python_utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
This stuff all still sucks but this is slightly better.
[python_utils.git]
/
lockfile.py
diff --git
a/lockfile.py
b/lockfile.py
index 7f10cc1f5894155c65ca352183afc0ea6d81fa37..ebd91158a54b80ed275bed990a3d9e35fedb0e0f 100644
(file)
--- a/
lockfile.py
+++ b/
lockfile.py
@@
-90,7
+90,6
@@
class LockFile(object):
pass
msg = f'Could not acquire {self.lockfile}.'
logger.warning(msg)
pass
msg = f'Could not acquire {self.lockfile}.'
logger.warning(msg)
- warnings.warn(msg)
return False
def acquire_with_retries(
return False
def acquire_with_retries(
@@
-127,7
+126,6
@@
class LockFile(object):
return self
msg = f"Couldn't acquire {self.lockfile}; giving up."
logger.warning(msg)
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):
raise LockFileException(msg)
def __exit__(self, type, value, traceback):
@@
-154,7
+152,6
@@
class LockFile(object):
cmd = self.override_command
else:
cmd = ' '.join(sys.argv)
cmd = self.override_command
else:
cmd = ' '.join(sys.argv)
- print(cmd)
contents = LockFileContents(
pid = os.getpid(),
commandline = cmd,
contents = LockFileContents(
pid = os.getpid(),
commandline = cmd,
@@
-178,7
+175,6
@@
class LockFile(object):
except OSError:
msg = f'Lockfile {self.lockfile}\'s pid ({contents.pid}) is stale; force acquiring'
logger.warning(msg)
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?
self.release()
# Has the lock expiration expired?
@@
-187,7
+183,6
@@
class LockFile(object):
if now > contents.expiration_datetime:
msg = f'Lockfile {self.lockfile} expiration time has passed; force acquiring'
logger.warning(msg)
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
self.release()
except Exception:
pass