Django-Celery Tasting Error?

I just started django-celery and got this warning:

DeprecationWarning: The `celery.decorators` module and the magic keyword arguments are pending deprecation and will be deprecated in 2.4, then removed in 3.0. `task.request` should be used instead of magic keyword arguments, and `celery.task.task` used instead of `celery.decorators.task`. See the 2.2 Changelog for more information. 

Here is my test task:

 from celery.decorators import task @task() def myProcessingFunction(): print "Zing!" return 1 

I call it from the view with:

 myProcessingFunction.delay() 

I can not find the documentation for this error. What's happening?

+4
source share
2 answers

We inform you that the decorator that you use (task ()) will be derived from subsequent versions of celery, so you should try to remove it from your code:

celery.task.task should be used instead of celery.decorators.task`

So

 from celery.task import task # instead of celery.decorators @task() def myProcessingFunction(): print "Zing!" return 1 
+7
source

According to http://docs.celeryproject.org/en/latest/internals/deprecation.html#old-task-api it seems that now you should also change

 from celery.task import task 

to

 from celery import task 
0
source

Source: https://habr.com/ru/post/1382781/


All Articles