Uranium
Application Framework
|
Manage a lock file for reading / writing in a directory. More...
Public Member Functions | |
def | __init__ |
Creates the locker instance that will hold the lock file. More... | |
def | __enter__ (self) |
Attempt to grab the lock file for personal use. More... | |
def | __exit__ (self, exc_type, exc_val, exc_tb) |
Release the lock file so that other processes may use it. More... | |
Manage a lock file for reading / writing in a directory.
filename | the filename to use as lock file |
timeout | in seconds; if the file is too old by this amount, then it gets ignored |
wait_msg | the message to log when waiting for the lock file to disappear |
example usage: $ with LockFile("my_lock_file.lock"): $ <do something="" in="" a="" directory>="">
def UM.LockFile.LockFile.__init__ | ( | self, | |
filename | |||
) |
Creates the locker instance that will hold the lock file.
filename | The name and path of the lockfile to create. |
timeout | After this amount of seconds, the lock will break regardless of the state of the file system. |
wait_msg | A message to log when the thread is blocked by the lock. It is intended that you modify this to better indicate what lock file is blocking the thread. |
def UM.LockFile.LockFile.__enter__ | ( | self | ) |
Attempt to grab the lock file for personal use.
def UM.LockFile.LockFile.__exit__ | ( | self, | |
exc_type, | |||
exc_val, | |||
exc_tb | |||
) |
Release the lock file so that other processes may use it.
exc_type | The type of exception that was raised during the with block, if any. Use None if no exception was raised. |
exc_val | The exception instance that was raised during the with block, if any. Use None if no exception was raised. |
exc_tb | The traceback frames at the time the exception occurred, if any. Use None if no exception was raised. |