Difference between different ways to create celery task Difference between different ways to create celery task python python

Difference between different ways to create celery task


Don't use #2 unless you are using celery v3. If you are using celery v4, use #1.

Use #3 in instances where you are writing a reusable library or django app. For example, if you are writing an open source set of tasks that allow you to manage aws ec2 instances using celery, you would use shared_task so that the tasks could be run on celery, but you would leave it to the person using your library to configure celery for themselves.

Use #1 if you are writing for your own project and there is no concern for re-use.