Skip to main content

Lock class based on the creation of directories in a folder

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
lockdir-0.11.tar.gz (1.9 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page