https://github.com/clinda-aau/pronco-django-db-locking

PCM-version of the third party django package django-db-locking.

https://github.com/clinda-aau/pronco-django-db-locking

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (7.5%) to scientific vocabulary
Last synced: 7 months ago · JSON representation

Repository

PCM-version of the third party django package django-db-locking.

Basic Info
  • Host: GitHub
  • Owner: CLINDA-AAU
  • Language: Python
  • Default Branch: master
  • Size: 104 KB
Statistics
  • Stars: 0
  • Watchers: 5
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created over 7 years ago · Last pushed about 1 year ago
Metadata Files
Readme Codeowners

README.rst

PCM-version of django-db-locking. Cloned from django-db-locking 2.0.7 on 2018-08-24.

Django-locking
==============

.. image:: https://coveralls.io/repos/github/vikingco/django-db-locking/badge.svg?branch=master
    :target: https://coveralls.io/github/vikingco/django-db-locking?branch=master
.. image:: https://travis-ci.org/vikingco/django-db-locking.svg?branch=master
    :target: https://travis-ci.org/vikingco/django-db-locking

Usage
-----
The simplest use is by using it as a context manager:

::

    with NonBlockingLock.objects.acquire_lock(obj=model_obj):
        model_obj.do_something()

Or you can keep track of the lock yourself:

::

    try:
        lock = NonBlockingLock.objects.acquire_lock(obj=model_obj)
    except AlreadyLocked:
        return False

    model_obj.do_something()
    lock.release()

If you have no Django model, or you want to be able to specify the lock name
yourself, you can do that too::

    # this will raise AlreadyLocked, if it's locked
    lock = NonBlockingLock.objects.acquire_lock(lock_name='my_lock')
    do_something()
    lock.release()

Note that locks can expire automatically. There is a `LOCK_MAX_AGE` settings where you can specify a default lock release value for locks in your entire Django codebase. This value can be overridden per lock by setting the `max_age` parameter.

Test
-----
You can run the tests with
::

    tox

Releases
--------
v2.0.0:
  Merging of master and pre-django-1.8 branches
  Removes management command in favor of a celery task
v1.2.1:
  Fix problem in migration to UUIDField for PostGres
v1.2.0:
  Move id to UUIDField, add code quality checks and CI
v1.1.0:
  Rename model to NonBlockingLock and add additional features
v1.0.1:
  Corrected tests and code clean-up
v1.0.0:
  Intial release.

Owner

  • Name: Center for Clinical Data Science (CLINDA)
  • Login: CLINDA-AAU
  • Kind: organization
  • Location: Aalborg, Denmark

Center for Clinical Data Science - Aalborg University & Aalborg University Hospital

GitHub Events

Total
  • Push event: 4
Last Year
  • Push event: 4

Dependencies

requirements/requirements_test.txt pypi
  • celery * test
  • coverage * test
  • coveralls * test
  • flake8 * test
  • flake8-debugger * test
  • flake8-print * test
  • freezegun * test
  • mccabe * test
  • pep8 * test
  • pep8-naming * test
  • pyflakes * test
  • pytest * test
  • pytest-cov * test
  • pytest-django * test
requirements/requirements.txt pypi
setup.py pypi