Skip to main content

Django Postgres Lock

Project description

Django Postgres Lock

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


Download files

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

Source Distribution

django_postgres_lock-0.3.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_postgres_lock-0.3-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file django_postgres_lock-0.3.tar.gz.

File metadata

  • Download URL: django_postgres_lock-0.3.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for django_postgres_lock-0.3.tar.gz
Algorithm Hash digest
SHA256 0aa6fbbdd592d66d904220c7e332f70b45b0cbb89457169a3d895e03fe87b63f
MD5 084e819d164305fef260230d98911505
BLAKE2b-256 8539434142675ba6d64f6902f3a603474c6924c33695e1ab13245d1208d768df

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_postgres_lock-0.3.tar.gz:

Publisher: publish.yml on developersociety/django-postgres-lock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_postgres_lock-0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for django_postgres_lock-0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ee4ceaa24b42a8294f27e0cfb40248b348a5aa7a699ce3993787ab65427bf94e
MD5 efeec2506666b3ca3d71e0f59f91baa4
BLAKE2b-256 94429b4464482bf0673adba3eae91836fae1f8484adcf4c1a83c5bab556c6898

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_postgres_lock-0.3-py3-none-any.whl:

Publisher: publish.yml on developersociety/django-postgres-lock

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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