Skip to content

freeman1981/pg-mutex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PG MUTEX

Python wrapper around Postgres pg_advisory_lock and pg_try_advisory_lock functions. It is possible, thanks to a common connection to the database, to block certain pieces of python code by different python processes, on different nodes.

Installation

pip install pg-mutex

Usage

from mutex import mutex

with mutex(connection, ['param1', 'param2']):
    # here is code that is guaranteed to be executed by only one process, even on different nodes
    pass

Run test

docker-compose run app wait-for db:5432 -- pytest -x --cov=. test_mutex.py --cov-fail-under 65

Run linter

docker-compose run app flake8

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors