Skip to main content

A Redis Backend for Celery with polling instead of pub/sub

Project description

Celery Redis Poll Backend

A specialized Redis backend for Celery that replaces the default pub/sub mechanism for task result retrieval with a polling-based approach.

Why Polling Instead of Pub/Sub?

The default Celery Redis backend uses Redis pub/sub for real-time task result notifications. While pub/sub provides immediate updates, it can face challenges in certain scenarios:

  • Deadlocks in highly concurrent/multi-threaded workloads due to single-threaded nature of Redis and Celery clients.
  • Higher overhead with SUBSCRIBE channels.

This backend provides a more robust alternative by using a polling mechanism instead.

Features

  • Polling-Based Results: Replaces pub/sub with a polling mechanism for task result retrieval
  • Compatible with Existing Code: Drop-in replacement for the standard Redis backend
  • Configurable Polling: Adjust polling intervals and timeouts to match your needs
  • Resource Efficient: Reduces Redis memory usage by eliminating pub/sub channels

Installation

pip install celery-redis-poll

After installation new backends are automatically registered with Celery:

  • redis+poll
  • rediss+poll
  • redis+cluster_poll
  • rediss+cluster_poll

Usage

Configure your Celery application to use the polling backend:

from celery import Celery

app = Celery('your_app',
             broker='redis://localhost:6379/0',
             backend='redis+poll://localhost:6379/0')

For clustered Redis, use redis+cluster_poll.

Requirements

  • Python >= 3.7
  • Celery >= 5.0.0
  • Redis >= 4.5.0
  • celery-redis-cluster >= 0.1.6

Development

For development, install extra dependencies:

pip install celery-redis-poll[dev]

License

This project is licensed under the MIT License.

Contributing

Contributions are welcome! Please feel free to submit issues and pull requests.

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

celery_redis_poll-0.1.12.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

celery_redis_poll-0.1.12-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file celery_redis_poll-0.1.12.tar.gz.

File metadata

  • Download URL: celery_redis_poll-0.1.12.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for celery_redis_poll-0.1.12.tar.gz
Algorithm Hash digest
SHA256 3b91d38f23fad179afbad5aeb26957608d00e55944b51fbd522d4a2e4b9db270
MD5 e0d60f5db241565ae41b04382c150c7a
BLAKE2b-256 3d35db08f41fdd4ee8d5495fe02d89f72b60051859f2cfb09cbb57b5c68145e0

See more details on using hashes here.

File details

Details for the file celery_redis_poll-0.1.12-py3-none-any.whl.

File metadata

File hashes

Hashes for celery_redis_poll-0.1.12-py3-none-any.whl
Algorithm Hash digest
SHA256 74854ae050fa0a1d7a374f477f422983f69dd4da841785c0179312da0240bf17
MD5 c2a8f3329b7dbdbc6240e25141941da1
BLAKE2b-256 c68565340f2566d37b5100a5d1bed4c66b67d0997c75f33ba12b2ecc99ded040

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