Django Postgres Lock
Project description
A Django management command which will run a command inside a Postgres lock, ensuring that only a single instance of the inner command will run.
Installation
Using pip:
$ pip install django-postgres-lock
Edit your Django project’s settings module, and add the application to INSTALLED_APPS:
INSTALLED_APPS = [
# ...
"postgres_lock",
# ...
]
Usage
To run clearsessions with the default lock:
$ ./manage.py command_lock -- ./manage.py clearsessions
To use a unique lock for this task:
$ ./manage.py command_lock --name clearsessions -- ./manage.py clearsessions
To exit immediately if a lock can’t be acquired:
$ ./manage.py command_lock --try --name clearsessions -- ./manage.py clearsessions
To ignore a lock failure and return a successful exit code:
$ ./manage.py command_lock --try --ignore-fail --name clearsessions -- ./manage.py clearsessions
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file django-postgres-lock-0.1.1.tar.gz
.
File metadata
- Download URL: django-postgres-lock-0.1.1.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0be614d18730740d39ae44705b30f5e71e3811e50692af7e01f5c05d1a8c7a0b |
|
MD5 | d39af37608b51fe274c5403b6e979f8a |
|
BLAKE2b-256 | fd39054140327b70bc2173be1ca7e6f0d8453748b8f439df4bd3c88990333841 |
File details
Details for the file django_postgres_lock-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: django_postgres_lock-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e22c9934bd4f24061398c19a734209658d2868226daf8e6f2625c23e1e27ffd0 |
|
MD5 | 4922798ff1b1938546a8e87af25ef307 |
|
BLAKE2b-256 | da12bcdc463865e4aa36d7ec4ca3465ec2728dc5c7aa9fa3230237143f8f557b |