yg.lockfile

Lockfile object with timeouts and context manager


License
MIT
Install
pip install yg.lockfile==2.3

Documentation

A FileLock class that implements a context manager with timeouts on top of zc.lockfile, an excellent, cross-platorm implementation of file locking.

License

License is indicated in the project metadata (typically one or more of the Trove classifiers). For more details, see this explanation.

Usage

Example usage:

import yg.lockfile
try:
    with yg.lockfile.FileLock('/tmp/lockfile', timeout=900):
            protected_operation()
except yg.lockfile.FileLockTimeout:
    handle_unable_to_lock()