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-nevaberry-plugins)
---
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 its workers, task workflows,
queues, result backends, schedules, or CLI integrations. Use the quick reference
for common changes and the topic files for detailed behavior and examples.
## Reference index
| File | Topics |
| --- | --- |
| [Compatibility and upgrade decisions](references/compatibility.md) | Python support, dependency constraints, SQS dependency changes, yanked releases |
| [Brokers and result backends](references/brokers-and-backends.md) | Broker connections, authentication, result keys and metadata, retries, expiration, storage integrations |
| [Queues and publishing](references/queues-and-publishing.md) | RabbitMQ quorum queues, routing, native delayed delivery, publishing timeouts, signing keys |
| [Scheduling and testing](references/scheduling-and-testing.md) | Cron and solar schedules, timezones, saved schedules, test workers, CLI integration |
| [Tasks and workflows](references/tasks-and-workflows.md) | Pydantic, annotations, task requests and signals, chains, replacements, chords, Canvas stamps |
| [Workers and shutdown](references/workers-and-shutdown.md) | Concurrency, acknowledgements, process loss, shutdown, ETA limits, prefetch, Django connections |
## Upgrade-sensitive behavior
Celery 5.7 requires Python 3.10 or later. Upgrade Python 3.9 environments before
installing it. Celery 5.6 is the last series to support Python 3.9, and its
supported PyPy versions start at 3.11.
Celery 5.3.2 and 5.3.3 were yanked for breaking changes to SQL result children
and eager-task name metadata; 5.3.4 reverted both changes. Celery 5.2.5 was also
yanked after a regression in the switch to `importlib`.
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.
When deciding whether to store a result, the task request's `ignore_result`
value takes precedence over the task definition's setting. Retries preserve
the request's override.
See [compatibility](references/compatibility.md) for dependency constraints and
[backends](references/brokers-and-backends.md) for result-storage behavior.
## Worker concurrency, acknowledgements, and process loss
Use `--concurrency=auto` to size the worker pool using cgroup limits:
```sh
celery -A proj worker --concurrency=auto
```
The asynchronous prefork pool supports the `spawn` process start method.
For tasks with late acknowledgements, 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
```
With late acknowledgments enabled, exceeding the hard time limit rejects the
task when `task_acks_on_failure_or_timeout = False`.
`task_retry_on_worker_lost` controls whether a task is requeued when the worker
process executing it is lost:
```python
app.conf.task_retry_on_worker_lost = True
```
## Shutdown and scheduled-task memory
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`; set it to `True` 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
```
Set `REMAP_SIGTERM=SIGQUIT` in the worker environment 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.
`worker_eta_task_limit` defaults to `None`, so ETA and countdown tasks held in
memory are unlimited unless you set a cap.
See [workers and shutdown](references/workers-and-shutdown.md) for Django pool
handling, prefetch, and task termination behavior.
## Quorum queues and publishing
Set `task_default_queue_type = "quorum"` for a quorum default task queue;
otherwise it uses `"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"`.
Configured routing can select a RabbitMQ quorum queue for `task.apply_async()`
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)
```
## 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}).
```
Task options include `pydantic_strict` (default `False`), `pydantic_context`
for validation context, and `pydantic_dump_kwargs` for serialization.
An annotation such as `Optional[Payload]` preserves `None` and applies model
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 [task reference](references/tasks-and-workflows.md)
includes the `double.apply(args=(Payload(value=4),))` example and annotation
handling details.
## Result backend controls
Set `redis_backend_credential_provider` to configure the Redis result backend's
credential provider for authentication such as AWS ElastiCache IAM.
Set `redis_client_name` to label result backend connections in Redis's client
list. Redis Sentinel deployments support a named Redis ACL user and password.
Transient Redis connection errors are eligible for retry when backend retries
are enabled. The Redis result backend can also be configured to treat
additional exception types as connection errors.
Use `result_chord_expires` for Redis chord-tracking keys and
`result_failure_expires` for stored failure results:
```python
app.conf.result_chord_expires = 3600
app.conf.result_failure_expires = 86400
```
The SQL result backend accepts retry configuration for database operations,
honors `result_serializer`, and provides a `SessionManager` `engine_callback`
hook for engine setup.
The database, MongoDB, and Cassandra result backends support retaining the
first `SUCCESS` result for a task ID when later attempts write to the same ID.
When a worker processes a revocation, it immediately records `REVOKED` in the
configured backend; callers can observe it through `AsyncResult.state`.
## Canvas behavior
Chaining a one-task `group` with `|` unwraps it: the next task receives the
single task's result directly. Celery applies a chord's `link` and
`link_error` options to its body signature.
With `worker_deduplicate_successful_tasks` enabled, a redelivery deduplicated
as already successful still dispatches linked callbacks and remaining chain
tasks. A cloned signature has independent task keyword arguments.
`Signature.stamp()` defaults to `append_stamps=False`; use `append_stamps=True`
to accumulate multiple values for the same stamp. A visitor's `on_signature()`
can return stamp values directly in a dictionary; `stamped_headers` is optional.
## Schedules, startup, and testing
`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")
```
Pass the global `--skip-checks` option before the subcommand to bypass Django's
system checks at worker startup:
```sh
celery -A proj --skip-checks worker
```
For a custom test worker hostname, pass `hostname` to
`celery.contrib.testing.worker.start_worker()` or provide it through the
`celery_worker_parameters` fixture for `celery.contrib.pytest`.