Celery
Distributed task queue for Python with brokers, scheduling, retries, and result backends.
Official Documentation ↗v5.4. Check the official docs for the latest API surface.Installation
pip install celeryMethods
No methods match this filter.
Celery is a simple, flexible, and reliable distributed task queue system for Python. It processes millions of tasks a day, using brokers to pass messages between clients and workers with retries, scheduling, and result tracking.
Key Features
- Brokers: Redis, RabbitMQ, SQS
- Result backends: Store and query task results
- Composition: chain, group, chord for workflows
- Retries: Automatic with exponential backoff
- Scheduling: Periodic tasks via beat
Errors
The official API reference declares the following error types:
celery.app.task.Task.MaxRetriesExceededError(exception(Task 上的异常类,任务最大重试次数超限时抛出)) — official text: “exception MaxRetriesExceededError(*args, **kwargs) The tasks max restart limit has been exceeded.” (source: https://docs.celeryq.dev/en/stable/reference/celery.app.task.html, fetched 2026-11-08T18:31:00+08:00)TypeError(apply_async 的 Raises 条目) — official text: “TypeError – If not enough arguments are passed, or too many arguments are passed. Note that signature checks may be disabled by specifying@task(typing=False).” (source: https://docs.celeryq.dev/en/stable/reference/celery.app.task.html, fetched 2026-11-08T18:31:00+08:00)ValueError(apply_async 的 Raises 条目) — official text: “ValueError – If soft_time_limit and time_limit both are set but soft_time_limit is greater than time_limit” (source: https://docs.celeryq.dev/en/stable/reference/celery.app.task.html, fetched 2026-11-08T18:31:00+08:00)kombu.exceptions.OperationalError(apply_async 的 Raises 条目(连接失败/断连)) — official text: “kombu.exceptions.OperationalError – If a connection to the transport cannot be made, or if the connection is lost.” (source: https://docs.celeryq.dev/en/stable/reference/celery.app.task.html, fetched 2026-11-08T18:31:00+08:00)RuntimeError(Celery 构造函数 autofinalize=False 时的抛出异常) — official text: “autofinalize (bool) – If set to False aRuntimeErrorwill be raised if the task registry or tasks are used before the app is “ (source: https://docs.celeryq.dev/en/stable/reference/celery.html, fetched 2026-11-08T18:31:00+08:00)
Security
Official security statements captured from the package documentation:
- Celery.setup_security 会禁用不受信任的序列化器(消息签名序列化器) — “Disables untrusted serializers and if configured to use the
authserializer will register theauthserializer with the provided settings into the Kombu serializer registry.” (source: https://docs.celeryq.dev/en/stable/reference/celery.html, fetched 2026-11-08T18:31:00+08:00) - setup_security 是影响所有应用实例的全局操作 — “This will affect all application instances (a global operation).” (source: https://docs.celeryq.dev/en/stable/reference/celery.html, fetched 2026-11-08T18:31:00+08:00)
API reference evidence
Fetched from official sources on 2026-11-08T18:31:00+08:00 via WebFetch https://docs.celeryq.dev/en/stable/reference/celery.html;WebFetch https://docs.celeryq.dev/en/stable/reference/celery.app.task.html;WebFetch https://docs.celeryq.dev/en/stable/userguide/canvas.html.
Celery()→ signature from https://docs.celeryq.dev/en/stable/reference/celery.html; official text: “class celery.Celery(main=None, loader=None, backend=None, amqp=None, events=None, log=None, control=None, set_as_current=True, tasks=None, broker=None, include=None, changes=None, *config_source”@app.task→ signature from https://docs.celeryq.dev/en/stable/reference/celery.html; official text: “task(*args, **opts)”delay / apply_async→ signature from https://docs.celeryq.dev/en/stable/reference/celery.app.task.html; official text: “apply_async(*args=None, kwargs=None, task_id=None, producer=None, link=None, link_error=None, shadow=None, **options)”retry→ signature from https://docs.celeryq.dev/en/stable/reference/celery.app.task.html; official text: “retry(*args=None, kwargs=None, exc=None, throw=True, eta=None, countdown=None, max_retries=None, **options)”
FAQ
- What brokers does Celery support?
- Celery supports Redis, RabbitMQ, Amazon SQS, and others as brokers. Redis is simplest for small setups; RabbitMQ offers stronger guarantees and routing for production workloads.
- How do I schedule periodic tasks?
- Use the celery beat scheduler with a schedule definition, or django-celery-beat for Django. Define tasks in a schedule dict with crontab or timedelta entries and run the beat process alongside workers.
- What is the difference between delay and apply_async?
- delay is a shortcut for apply_async with positional args only. apply_async gives full control over countdown, eta, queue, retry policy, and routing, so prefer it for production configuration.
Report a problem with this API docOpens a pre-filled issue on GitHub.