skillfed

celery_once

Allows you to prevent multiple execution and queuing of celery tasks.

celery-once v3.0.1 275.5K downloads/30d#8,176 on PyPI689
Permissive license BSD Abandoned released

What it is and what it does

Celery Once is a Celery extension that adds distributed task locking to prevent the same task from being queued or executed multiple times concurrently. It works by intercepting task scheduling calls (delay and apply_async) and checking a lock in a backend store (Redis or filesystem) before allowing execution. If a lock already exists, it raises an AlreadyQueued exception or returns None gracefully, depending on configuration.

The package lets you configure which task arguments determine lock identity, set lock timeouts, and choose when locks are released (after task completion or before execution). It is designed for scenarios where you want to ensure a long-running or resource-intensive task does not pile up in the queue or run in parallel, but the project has been unmaintained since 2019 and may not work reliably with current Celery and Python versions.

Use it for:

  • Prevent duplicate report generation tasks from queuing when a user clicks a button multiple times before the first report completes.
  • Ensure only one data sync task runs at a time across a distributed worker pool, even if triggered by multiple sources.
  • Block redundant cleanup or maintenance tasks from running concurrently when scheduled by multiple cron jobs or webhooks.
  • Enforce single-execution semantics for expensive API calls or database operations triggered by task retries or event handlers.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Prevents duplicate execution and queuing of Celery tasks by enforcing distributed locks, allowing you to ensure a task runs only once even if scheduled multiple times concurrently.

No. The package is abandoned (last release 2019, no commits since 2023) and unlikely to work with modern Celery or Python versions. If you need task deduplication in an active Celery project, seek a maintained alternative or implement locking directly using Redis or your message broker's native capabilities.

Install

celery-once on PyPI

pip

pip install celery-once

uv

uv add celery-once

poetry

poetry add celery-once

Installing celery_once

Before you install

High install friction: the package has been abandoned since 2019 with no updates for over 2550 days, and it requires external infrastructure (Redis or file-based locking) to function. No runtime dependencies are declared, but Celery itself is a hard requirement that must be installed separately.

License in practice

BSD license is permissive, imposing no significant restrictions on use or redistribution in most contexts.

Quickstart

pip install celery_once

from celery import Celery
from celery_once import QueueOnce

celery = Celery('tasks', broker='amqp://guest@localhost//')
celery.conf.ONCE = {'backend': 'celery_once.backends.Redis', 'settings': {'url': 'redis://localhost:6379/0', 'default_timeout': 3600}}

@celery.task(base=QueueOnce)
def my_task():
    return "Done!"

Requires Celery 4.0 or later, a running message broker (e.g. RabbitMQ), and a Redis instance or writable filesystem for lock storage.

Verify before relying

  • Whether the package works reliably with Celery versions released after 2019 or with modern Python 3.10+.
  • Whether the Redis backend handles connection failures or network partitions gracefully.
  • Whether lock cleanup is guaranteed under all failure scenarios (e.g. task crashes, worker death).

Package facts

License BSD (permissive)
Python support not specified
Install friction high — source build required
Runtime dependencies none
Maintenance abandoned — 2,550 days since the last release
Last repo commit
First released
Downloads 275,459/month — #8,176 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: celery_once-3.0.1.tar.gz

Keywords: celery

Intended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseNatural Language :: EnglishProgramming Language :: Python :: 2Programming Language :: Python :: 2.6Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.3Programming Language :: Python :: 3.4Topic :: System :: Distributed Computing

Tags

celery task deduplicationprevent duplicate celery taskscelery task lockingcelery once executiondistributed task lockcelery queue deduplicationcelery task idempotence
celery-extensiontask-lockingabandoned

More Distributed Computing packages