Skip to content

Conversation

@davidism
Copy link
Member

The existing Celery docs didn't fit particularly well with the application factory, or with modern Celery configuration, or with testing patterns. I've rewritten the docs from scratch to try to focus on the topics that matter for understanding Celery's model and how it fits with Flask. I've also added a full example showing how to use Celery and run tasks with JavaScript.

In particular, use @shared_task instead of @celery.task. This way, tasks objects are created for the current Flask app. A Celery app is associated with the Flask app and configured from it each time the factory is called. This relies on Celery's "default app" concept.

Based on what I figured out for these docs, I think it would be able to take this further and create a Flask extension that manages it for us and doesn't require shared_task or the default app, but that's outside the scope of these docs.

closes #4837

@davidism davidism added the docs label Feb 10, 2023
@davidism davidism merged commit d552726 into 2.2.x Feb 10, 2023
@davidism davidism deleted the docs-celery branch February 10, 2023 17:35
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants