This stuff all still sucks but this is slightly better.
[python_utils.git] / lockfile.py
index 7f10cc1f5894155c65ca352183afc0ea6d81fa37..ebd91158a54b80ed275bed990a3d9e35fedb0e0f 100644 (file)
@@ -90,7 +90,6 @@ class LockFile(object):
             pass
         msg = f'Could not acquire {self.lockfile}.'
         logger.warning(msg)
-        warnings.warn(msg)
         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)
-        warnings.warn(msg)
         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)
-        print(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)
-                        warnings.warn(msg)
                         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)
-                            warnings.warn(msg)
                             self.release()
         except Exception:
             pass