__init__

LockMgr.__init__(name, expires: Optional[int] = 600, locked_by=None, lock_process=None, wait: int = None)[source]

Create an instance of LockMgr. This class is primarily intended to be used as a context manager (i.e. with LockMgr('mylock') as l:), see the main PyDoc block for LockMgr for more info.

Parameters
  • name (str) – The lock name to create (when using as a context manager)

  • expires (int) – How many seconds before this lock is considered stale and forcefully released?

  • locked_by (str) – (Optional) Who/what is using this lock. Defaults to system hostname.

  • lock_process (int) – (Optional) The process ID of the app using this lock

  • wait (int) – (Optional) Wait this many seconds for a lock to be released before giving up. If this is None then waiting will be disabled