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.

Source Distribution

lockdir-0.11.tar.gz (1.9 kB view details)

Uploaded Source

File details

Details for the file lockdir-0.11.tar.gz.

File metadata

  • Download URL: lockdir-0.11.tar.gz
  • Upload date:
  • Size: 1.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for lockdir-0.11.tar.gz
Algorithm Hash digest
SHA256 fc949f6954890bd21a16adb73f9316513fd11441b945810be557b9d75ffd3b0e
MD5 144c5c59135ba3a045970716f12df8d0
BLAKE2b-256 f56a87c13c84edf697a0c5999a370141280b57bf599b6369a34747cadfd30c82

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page