locker lock serverpylocker - python client for
Allows to lock common resources across servers with sub-second precision in python.
Check out locker server page for server installation instructions.
Clone this repository to whatever place you keep your python modules.
from pylocker import Locker # create locker server connection locker = Locker("127.0.0.1", 4545) # create lock object with some nice name lock = locker.create_lock("fuu") # acquire lock, wait for it for 500ms if it's taken lock.acquire(500, 200) # do whatever you need for up to 200ms # and release lock lock.release()
from pylocker import Locker
locker = Locker("127.0.0.1", 4545)
lock = locker.create_lock(name)
wait- max time to wait for lock (in milliseconds).
timeout- max work time before
releasecall or auto-release by timeout (in milliseconds).
lock.release(panic = False)
panic = True then
LostLockException will be raised if time between
release was more than
- @unfollowr - twitter bot to track people who unfollowed you