Python client for locker lock server
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

pylocker - python client for locker lock server

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("", 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


  • Importing:

    from pylocker import Locker
  • New connection:

    locker = Locker("", 4545)
  • Lock creation:

    lock = locker.create_lock(name)
  • Acquiring lock:

    lock.acquire(wait, timeout)
    • wait - max time to wait for lock (in milliseconds).
    • timeout - max work time before release call or auto-release by timeout (in milliseconds).
  • Releasing lock:

    lock.release(panic = False)

If panic = True then LostLockException will be raised if time between acquire and release was more than timeout.


  • @unfollowr - twitter bot to track people who unfollowed you