BullMQ For Python
This is the official BullMQ Python library. It is a close port of the NodeJS version of the library. Python Queues are interoperable with NodeJS Queues, as both libraries use the same .lua scripts that power all the functionality.
Features
Currently, the library does not support all the features available in the NodeJS version. The following have been ported so far:
-
Add jobs to queues.
- Regular jobs.
- Delayed jobs.
- Job deduplication.
- Job priority.
- Repeatable (via
JobScheduler).
-
Workers
-
Job events (via
QueueEventsandQueueEventsProducer). -
Job progress.
-
Job retries.
-
Job backoff.
-
Getters.
-
Lock Manager (batched lock renewal).
-
Per-job cancellation (cooperative
AbortController).
Installation
pip install bullmq
Usage
Basic Example
from bullmq import Queue
queue = Queue('my-queue')
job = await queue.add('my-job', {'foo': 'bar'})
Job Priority
Prioritize jobs so higher priority jobs are processed first. Lower number = higher
priority. 1 is the highest priority and 2_097_152 is the lowest. A priority of
0 (the default) means "no priority" and jobs are processed in FIFO order.
from bullmq import Queue
queue = Queue('my-queue')
# Higher priority job (will be processed first)
await queue.add('paint', {'color': 'red'}, {'priority': 1})
# Lower priority job
await queue.add('paint', {'color': 'blue'}, {'priority': 10})
Job Deduplication
Prevent duplicate jobs from being added to the queue:
from bullmq import Queue
queue = Queue('my-queue')
# Simple mode - deduplicates until job completes or fails
job = await queue.add('paint', {'color': 'white'}, {
'deduplication': {
'id': 'custom-dedup-id'
}
})
# Throttle mode - deduplicates for a specific time window (in milliseconds)
job = await queue.add('paint', {'color': 'white'}, {
'deduplication': {
'id': 'custom-dedup-id',
'ttl': 5000 # 5 seconds
}
})
# Debounce mode - replaces pending job with latest data
job = await queue.add('paint', {'color': 'white'}, {
'deduplication': {
'id': 'custom-dedup-id',
'ttl': 5000,
'extend': True, # Extend TTL on each duplicate attempt
'replace': True # Replace job data with latest
},
'delay': 5000 # Must be delayed for replace to work
})
Documentation
The documentation is available at https://docs.bullmq.io
License
MIT
Copyright
Copyright (c) 2018-2023, Taskforce.sh Inc. and other contributors.
Release files for bullmq 3.2.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bullmq-3.2.7.tar.gz | 887.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bullmq-3.2.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.9 MB
Release files / bullmq-3.2.7.tar.gz
| Download URL | bullmq-3.2.7.tar.gz |
|---|---|
| Size | 887.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9331f94cd580f8b391650beff82159b48070cc4b89ff92f7af410d67b985e052
|
|
BLAKE2b-256 checksum How to use checksums |
a5eb7d94e644ec98fcdf282b22b579f8ff9ff4159463e4c98b4668eecb190db9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.7
|
Release files / bullmq-3.2.7-py3-none-any.whl
| Download URL | bullmq-3.2.7-py3-none-any.whl |
|---|---|
| Size | 1.0 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d962840dc0d110ffdef5b3ed971a332e2bc8894521bab97a1b105e28ae261ff2
|
|
BLAKE2b-256 checksum How to use checksums |
4d099b44dff0733f6942239084ed6a9e23317e7efa75eda1104222aee3864709
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.7
|