Skip to main content

BullMQ for Python (LitHaxor fork) — adds JobScheduler, global rate limit/concurrency, per-job cancellation, and QueueEvents streams.

Project description

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.
  • Workers

  • Job events.

  • Job progress.

  • Job retries.

  • Job backoff.

  • Getters.

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.

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

lithaxor_bullmq_python-2.27.0.tar.gz (101.6 kB view details)

Uploaded Source

Built Distribution

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

lithaxor_bullmq_python-2.27.0-py3-none-any.whl (154.2 kB view details)

Uploaded Python 3

File details

Details for the file lithaxor_bullmq_python-2.27.0.tar.gz.

File metadata

  • Download URL: lithaxor_bullmq_python-2.27.0.tar.gz
  • Upload date:
  • Size: 101.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for lithaxor_bullmq_python-2.27.0.tar.gz
Algorithm Hash digest
SHA256 70d7183be34a7793c85e18eb00e4015c15b5ad1fa05dfeb7eaf6bfbf87e42c57
MD5 4b8f31bb5b54befbfb605fe363ff625d
BLAKE2b-256 06e30ac8c856a316c9681cfc3eb7d7d2d4a003cc37ece8b0bf07695879c5bfba

See more details on using hashes here.

File details

Details for the file lithaxor_bullmq_python-2.27.0-py3-none-any.whl.

File metadata

File hashes

Hashes for lithaxor_bullmq_python-2.27.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3c9ce3cee8c78732677fcc8840f11dfac4bf59c93f9d2b56ae6ca48d8f7a8b27
MD5 59c19cdbdf3f9b297eddf63af8e1c5c5
BLAKE2b-256 9466edf2df2bac44cbd1502a96660cc4502b369324e1ce08a1bc8d367300b513

See more details on using hashes here.

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