This project has been archived by its maintainers, and is no longer receiving any updates.
===========
Celery Mutex is a mutex for Celery Tasks, optionally refined based on provided
keys. This mutex prevents execution of concurrent tasks, as opposed to delaying
execution.
Installation
------------
Simply run `pip install celery_mutex`
Requirements
------------
Celery Mutex relies on [ZooKeeper](http://zookeeper.apache.org/).
Usage
-----
Celery Mutex takes advantage of Abstract Tasks for Celery. To utilize this
abstract task, add it as a base for the task:
import celery_mutex
@app.task(base=celery_mutex.MutexTask)
def my_task(a, b):
return a + b
A new configuration variable is required in order to let Celery Mutex know
about your ZooKeeper servers:
ZOOKEEPER_HOSTS = 'localhost:2181'
This is a comma-separated list of hosts to connect to.
By default a mutex times out after one hour. This can be changed globally by
setting `MUTEX_TIMEOUT` or per-task by setting `mutex_timeout` on the task. For
both the value is an integer for the number of seconds to set the time out.
A second configuration option allows you to refine the mutex for a given task.
By default, Celery Mutex only allows one instance of a task at a time. However,
there may be a need to further refine what is controlled by the mutex. This can
be done by setting `mutex_keys` on the task. The value is a list of keys that
are to be used for determining exclusivity.
Using our above example, adding the two optional parameters would yield:
import celery_mutex
@app.task(base=celery_mutex.MutexTask, mutex_timeout=30, mutex_keys=('a',))
def my_task(a, b):
return a + b
This would cause the mutex to only prevent execution for tasks that share the
same value for "a".
Metadata
Release files for celery_mutex 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| celery_mutex-0.1.0.tar.gz | 3.5 kB | Without provenance | Details for celery_mutex-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| celery_mutex-0.1.0-py27-none-any.whl | Python 2.7 | none | any | Details for celery_mutex-0.1.0-py27-none-any.whl |
Total release size: 9.0 kB
Release files / celery_mutex-0.1.0.tar.gz
| Download URL | celery_mutex-0.1.0.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8013ba3ec9aa5288818f43ab949d93936921a8724d82db74c57100c354b3eb6d
|
|
BLAKE2b-256 checksum How to use checksums |
8932af1369d9ebfb9857286e943963a6cd8b836a531bfd6092e179867176eba6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / celery_mutex-0.1.0-py27-none-any.whl
| Download URL | celery_mutex-0.1.0-py27-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 2.7 |
|
SHA-256 checksum How to use checksums |
cc08458dee7739565d749b578a1a2efe4f0fb4b091750e673535f5e2b9c6ab75
|
|
BLAKE2b-256 checksum How to use checksums |
8f2e3cdab0b1d3b9fbde50e71efdfc095977df1f40884db1de9810d65b454061
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for celery_mutex 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.