yg.lockfile

Lockfile object with timeouts and context manager


License
MIT
Install
pip install yg.lockfile==2.0

Documentation

image

image

image

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

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()