Skip to main content

BullMQ for Python

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 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


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bullmq-2.18.1.tar.gz (783.3 kB view details)

Uploaded Source

Built Distribution

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

bullmq-2.18.1-py3-none-any.whl (897.7 kB view details)

Uploaded Python 3

File details

Details for the file bullmq-2.18.1.tar.gz.

File metadata

  • Download URL: bullmq-2.18.1.tar.gz
  • Upload date:
  • Size: 783.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for bullmq-2.18.1.tar.gz
Algorithm Hash digest
SHA256 c1c72c8d6d973ba2bd0ef87f08648577d61e8d694a405225a76fe320bfcca316
MD5 8415b383e1a820c3d26efdf06ab38b9d
BLAKE2b-256 db1b7f8e1c9e943ab482f0c1476852ca1385eeab4ccfb90e3ece5898c0bc9631

See more details on using hashes here.

File details

Details for the file bullmq-2.18.1-py3-none-any.whl.

File metadata

  • Download URL: bullmq-2.18.1-py3-none-any.whl
  • Upload date:
  • Size: 897.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for bullmq-2.18.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c344c3a95b90858ed2cb85a32e2fdee9efa23cb91af5a81ba9e862e71226829a
MD5 dfa53b76f0986e2ad1b62a1e71b4e88d
BLAKE2b-256 66ad3858c668ba02755e5a7fe06da4e482f9ec5d73a0a2b9dca810758bae2900

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