Overview
Celery 5.3, released on June 7, 2023, improves the canvas system and adds Django 4.2 support.
Main Features
Canvas improvements
The canvas system (chains, groups, chords) benefits from reliability fixes and better error handling in complex workflows.
python
from celery import Celery, chain, group
app = Celery('tasks', broker='redis://localhost')
@app.task
def add(x, y):
return x + y
@app.task
def multiply(x, y):
return x * y
# Canvas: task chain
workflow = chain(
add.s(4, 4),
multiply.s(2),
)
result = workflow.apply_async()
Django 4.2 support
Celery 5.3 is fully compatible with Django 4.2, supporting new ORM features and the improved Redis cache backend.
python
# settings.py (Django)
# CELERY_BROKER_URL = 'redis://localhost:6379/0'
# CELERY_RESULT_BACKEND = 'django-db'
from celery import shared_task
@shared_task
def send_notification_email(recipient, subject):
# Async task in Django
from django.core.mail import send_mail
send_mail(subject, 'Content', 'from@ex.com', [recipient])
return f'Email sent to {recipient}'
