This is a class that tries to limit the number of multiple simultaneous executions of a python script, on a local computer. It works by creating folders (using a pattern) under a folder. If the folder is successfully created, the execution gains the lock. Otherwise the script waits up to a configurable time to try to create the folder.
Example:
from lockdir import LockDir
lock = lockdir.LockDir(parallelruns=5, secondswait=300, lockdir="/tmp/lockdir.lock")
if not lock.acquire_lock():
print "Error acquiring lock"
sys.exit(1)
# do the job
lock.clean_lock()
Example:
from lockdir import LockDir
lock = lockdir.LockDir(parallelruns=5, secondswait=300, lockdir="/tmp/lockdir.lock")
if not lock.acquire_lock():
print "Error acquiring lock"
sys.exit(1)
# do the job
lock.clean_lock()
Metadata
Release files for lockdir 0.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lockdir-0.11.tar.gz | 1.9 kB | Details |
Release files / lockdir-0.11.tar.gz
| Download URL | lockdir-0.11.tar.gz |
|---|---|
| Size | 1.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fc949f6954890bd21a16adb73f9316513fd11441b945810be557b9d75ffd3b0e
|
|
BLAKE2b-256 checksum How to use checksums |
f56a87c13c84edf697a0c5999a370141280b57bf599b6369a34747cadfd30c82
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |