Skip to main content

Lock script to allow only one instance

Project description

Build Status Requirements Status

Lock tool for scripts.

Package

Example

import time
import atexit

from scriptlock import Lock

lock = Lock()
atexit.register(lock.cleanup)  # Needed to clean the lock correctly

time.sleep(100)

Launch another one and see what happend

Workaround

The use of atexit is necessary to correctly clean the lock. We tried to use the del module but it caused issues with the logger.

Tests

Testing is set up using pytest and coverage is handled with the pytest-cov plugin.

Run your tests with py.test in the root directory.

Coverage is ran by default and is set in the pytest.ini file. To see an html output of coverage open htmlcov/index.html after running the tests.

TODO

Travis CI

There is a .travis.yml file that is set up to run your tests for python 2.7 and python 3.2, should you choose to use it.

TODO

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

scriptlock-1.0.5-py2.py3-none-any.whl (4.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file scriptlock-1.0.5-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for scriptlock-1.0.5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 86e36c684fd594990662c66072713d52907953406bb2b309b4d5c29043c07426
MD5 2811185294eb5e01ec083f01f09e7df8
BLAKE2b-256 00fd3e7be634ccf416075d77c999d1e5cbd469744484ece0a7c2fb4f08b58cf8

See more details on using hashes here.

Supported by

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