Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Celery Knowledge Patch?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/nevaberry-celery-knowledge-patch)
---
name: celery-knowledge-patch
description: Celery
version: "5.7.0"
license: MIT
metadata:
author: Nevaberry
---
# Celery Compatibility Guidance
Load this skill when upgrading Celery or working on broker configuration,
worker lifecycle, task workflows, scheduling, and result storage.
Use the topic references for complete guidance and release-specific context.
> [!CAUTION]
> Prerelease guidance may change before stable release. The references mark
> each item derived from a prerelease with its exact source batch ID.
## Reference index
| Reference | Topics |
| --- | --- |
| [Brokers, Queues, and Publishing](references/brokers-and-queues.md) | Kombu constraints, SQS, Google Cloud Pub/Sub, RabbitMQ quorum queues, delayed delivery, publishing, Redis Sentinel |
| [Result Backends](references/result-backends.md) | Result keys and metadata, Redis authentication and expiration, SQL engine setup and retries, cloud storage, other backends |
| [Runtime and Worker Lifecycle](references/runtime-and-lifecycle.md) | Python and dependency support, shutdown, capacity, process setup, Django, CLI, testing |
| [Tasks, Workflows, and Scheduling](references/tasks-and-scheduling.md) | Pydantic, annotations, acknowledgements, task requests, Canvas, chords, stamping, schedules, signing |
## Upgrade-sensitive behavior
Celery 5.7 requires Python 3.10 or later. Upgrade Python 3.9 environments
before installing this release.
When `global_keyprefix` already ends in a separator, Celery uses it as supplied.
For example, `myapp:` produces keys beginning with `myapp:celery-task-meta-`.
This changes the keys used to look up results written with the extra separator.
`database_create_tables_at_setup` defaults to `True`: the SQLAlchemy result
backend creates tables during initialization. Set it to `False` to defer
creation until the tables are needed.
With late acknowledgements, exceeding the hard time limit rejects the task
when `task_acks_on_failure_or_timeout = False`. Tasks can also configure
`acks_on_failure` and `acks_on_timeout` independently:
```python
@app.task(acks_late=True, acks_on_failure=True, acks_on_timeout=False)
def divide(a, b):
return a / b
```
`task_retry_on_worker_lost` controls whether a task is requeued when the worker
process executing it is lost.
The request's `ignore_result` takes precedence over the task definition when
deciding whether to store a result. Retries preserve the request's override.
## Worker shutdown and capacity
A positive `worker_soft_shutdown_timeout` gives running tasks that many
seconds to finish before cold shutdown cancels them. Its default is `0.0`
(disabled). `worker_enable_soft_shutdown_on_idle` defaults to `False`; enable
it to apply the grace period even when no tasks are executing.
```python
worker_soft_shutdown_timeout = 10.0
worker_enable_soft_shutdown_on_idle = True
```
To make TERM request cold shutdown, preceded by soft shutdown if enabled:
```sh
export REMAP_SIGTERM=SIGQUIT
```
Workers keep sending configured broker heartbeats during warm shutdown while
active tasks finish. A gevent worker can terminate a running task through
`result.revoke(terminate=True)`.
`worker_eta_task_limit` defaults to `None`, leaving the number of ETA and
countdown tasks held by a worker unlimited unless you set a cap.
Use cgroup limits to size the worker pool automatically:
```sh
celery -A proj worker --concurrency=auto
```
The asynchronous prefork pool supports the `spawn` process start method.
## RabbitMQ queues and publishing
`task_default_queue_type = "quorum"` selects a quorum queue for the default
task queue; otherwise the type is `"classic"`. `worker_detect_quorum_queues`
is enabled by default. Detected quorum queues trigger native delayed delivery
for ETA tasks, and `broker_native_delayed_delivery_queue_type` defaults to
`"quorum"` for the delayed-delivery queues.
With quorum queues, `broker_url` accepts a list of failover URLs.
`task.apply_async()` can publish to a quorum queue selected by configured
routing without an explicit `queue=` argument.
`Task.apply_async()` forwards `timeout` and `confirm_timeout` to Kombu's
producer. `confirm_timeout` bounds the confirmation wait when publisher
confirms are enabled.
```python
task.apply_async(timeout=10, confirm_timeout=5)
```
Worker broker connections can use transport options that differ from those
used for publishing tasks.
## Pydantic task arguments and results
With `pydantic=True`, callers send serializable values such as dictionaries.
The worker validates annotated arguments into Pydantic models and serializes
an annotated model result to a dictionary.
```python
from celery import Celery
from pydantic import BaseModel
app = Celery("tasks")
class TaskInput(BaseModel):
value: int
class TaskResult(BaseModel):
doubled: int
@app.task(pydantic=True)
def double(arg: TaskInput) -> TaskResult:
return TaskResult(doubled=arg.value * 2)
# A producer can publish with double.delay({"value": 4}).
```
`pydantic_strict` defaults to `False`. Use `pydantic_context` for validation
context and `pydantic_dump_kwargs` for model serialization. An annotation such
as `Optional[Payload]` preserves `None` and applies validation or serialization
when a value is present.
A task with `pydantic=True` also accepts a model instance for an argument
annotated with that model type; the reference includes a `Task.apply()` example.
## Canvas and task results
Chaining a one-task `group` with `|` unwraps it: the next task receives the
single task's result directly.
```python
workflow = group(add.s(1, 2)) | consume.s() # consume receives 3
```
With `worker_deduplicate_successful_tasks` enabled, a redelivery deduplicated
as already successful still dispatches linked callbacks and the remaining
tasks in its chain.
Celery applies a chord's `link` and `link_error` options to its body signature.
A cloned signature has independent task keyword arguments, so changing them
on the clone leaves the original signature's keyword arguments intact.
`Signature.stamp()` defaults to `append_stamps=False`. To accumulate multiple
values for the same stamp:
```python
sig.stamp(append_stamps=True, campaign="billing")
```
## Result backend controls
Set `redis_backend_credential_provider` to configure Redis result backend
authentication through a credential provider, such as AWS ElastiCache IAM.
`redis_client_name` labels result backend connections in Redis's client list.
```python
app.conf.redis_client_name = "orders-results"
app.conf.result_chord_expires = 3600
app.conf.result_failure_expires = 86400
```
`result_chord_expires` controls the lifetime of Redis keys tracking chords;
`result_failure_expires` controls stored failure result lifetimes. The Redis
backend counts each header task once toward chord completion, even if it
reports more than once. Transient Redis connection errors are eligible for
retry when backend retries are enabled.
When a worker processes a revocation, it immediately records `REVOKED` in the
configured result backend; callers can observe it through `AsyncResult.state`.
`result_extended` enables extended fields such as task arguments. For backends
that record periodic task names, supply the schedule entry name in the header:
```python
task.apply_async(headers={"periodic_task_name": "nightly-report"})
```
## Scheduling and CLI
`crontab.from_string()` accepts a five-field cron expression, and
`month_of_year` accepts month names:
```python
from celery.schedules import crontab
daily_at_nine = crontab.from_string("0 9 * * *")
january_at_nine = crontab(minute=0, hour=9, month_of_year="jan")
```
Beat computes `dusk_astronomical` using a solar elevation of −18°.
Place the global `--skip-checks` option before the subcommand to bypass Django
system checks at worker startup. Inspect JSON output does not require `--quiet`.
```sh
celery -A proj --skip-checks worker
celery -A proj inspect --json ping
```
Registered custom remote commands are exposed through `celery inspect` or
`celery control`, according to how they were registered. Daemonization options
can be read from the Celery application's configuration.