celery-singleton
Prevent duplicate celery tasks
What it is and what it does
Celery-Singleton is a base class for Celery tasks that enforces at-most-one-instance semantics: when you call delay() or apply_async() on a singleton task, it either queues a new task or returns the AsyncResult of an already-queued or running task with identical name and arguments. It uses Redis-backed distributed locking with task name and arguments hashed as the lock key, preventing duplicate work from clogging your message broker.
The package works transparently with standard Celery—no special exception handling needed. Locks are held until the task completes (success or failure), then released. You can configure which arguments determine uniqueness via the unique_on parameter, set lock expiry times to handle worker crashes, or raise exceptions on duplicate attempts instead of returning existing results. It requires a Redis server and JSON-serializable task arguments.
Use it for:
- Prevent duplicate long-running reports or data exports from queuing when users click submit multiple times
- Ensure only one instance of a periodic cleanup or maintenance task runs at a time across distributed workers
- Rate-limit task execution by argument (e.g., one sync per user) without time-based delays
- Protect against thundering herd problems when multiple services trigger the same background job
- Simplify task deduplication logic by inheriting from Singleton instead of manual lock management
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Prevents duplicate Celery tasks from being queued or running simultaneously by using task name and arguments to determine uniqueness, with Redis-backed distributed locking.
Yes, if you are already committed to Celery and Redis and need simple deduplication without custom locking logic. However, proceed with caution: the package is abandoned (last release 2021-01-14, last commit 2023-06-09), so compatibility with recent Celery versions is unverified and no bug fixes are forthcoming. Evaluate whether a maintained fork or alternative exists before adopting for new projects.
Install
celery-singleton on PyPI
pip
pip install celery-singletonuv
uv add celery-singletonpoetry
poetry add celery-singletonInstalling celery-singleton
Before you install
Low install friction with only two runtime dependencies (celery and redis). However, the package is abandoned—last release was 2021-01-14 and last commit 2023-06-09—so no active maintenance or bug fixes should be expected.
License in practice
MIT license is permissive, allowing commercial and private use with minimal restrictions, making it safe from a licensing perspective for most projects.
Quickstart
pip install celery-singleton
from celery_singleton import Singleton
@celery_app.task(base=Singleton)
def do_stuff(*args, **kwargs):
return 'result'
async_result = do_stuff.delay(1, 2, 3, a='b')
async_result2 = do_stuff.delay(1, 2, 3, a='b')
assert async_result == async_result2
Requires a Redis server configured as the Celery result backend (or specified separately via singleton_backend_url config). All task arguments must be JSON serializable.
Verify before relying
- Whether the package remains compatible with recent Celery versions released after 2023-06-09
- Whether Redis backend compatibility extends to modern Redis versions and Redis-compatible services
- Active community forks or maintained alternatives that address the abandoned status
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.6,<4.0) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — celery, redis |
| Maintenance | abandoned — 2,038 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 352,762/month — #7,310 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: celery_singleton-0.3.1-py3-none-any.whl
Tags
More Distributed Computing packages
gRPC Python is an HTTP/2-based RPC framework…
permissive · top 100 on PyPI
execnetexecnet lets you spawn and communicate with…
permissive · top 1,000 on PyPI
cloudpickleCloudpickle extends Python's standard pickle…
permissive · top 1,000 on PyPI
smart-openProvides a unified, open()-compatible Python…
permissive · top 1,000 on PyPI
portalockerPortalocker provides cross-platform file…
permissive · top 1,000 on PyPI
rayRay is a distributed computing framework that…
permissive · top 1,000 on PyPI
celery_oncePrevents duplicate execution and queuing of…
permissive · top 15,000 on PyPI
celery-batchesCelery Batches provides a Task class that…
permissive · top 15,000 on PyPI
celeryCelery is a distributed task queue that lets…
permissive · top 1,000 on PyPI
celery-redbeatRedBeat is a Celery Beat scheduler that…
permissive · top 5,000 on PyPI
redlockImplements the RedLock algorithm to provide…
permissive · top 15,000 on PyPI
tenant-schemas-celeryIntegrates Celery task queuing with…
permissive · top 15,000 on PyPI
arqarq provides a job queue system for Python that…
permissive · top 5,000 on PyPI
redlock-pyImplements Redis-based distributed locks using…
permissive · top 15,000 on PyPI
python-redis-lockProvides a Redis-backed distributed lock with a…
permissive · top 5,000 on PyPI
dvc-taskdvc-task queues and runs background jobs from…
permissive · top 5,000 on PyPI