Celery Deprecation Timeline
-
to:
AsyncResult.serializable() and celery.result.from_serializable will be removed.
Compat Task Modules
Module celery.decorators will be removed:
Which means you need to change:
from celery.decorators import task
Into:
Module celery.task may be removed (not decided)
This means you should change:
from celery.task import task
into:
—and::
from celery.task import Task
into:
from celery import Task
Note that the new Task class no longer uses classmethods for these methods:
- delay
- apply_async
- retry
- apply
- AsyncResult
- subtask
This also means that you can’t call these methods directly on the class, but have to instantiate the task first:
TaskSet
Old:
>>> from celery.task import TaskSet
>>> TaskSet(add.subtask((i, i)) for i in xrange(10)).apply_async()
New:
>>> from celery import group
Magic keyword arguments
The magic keyword arguments accepted by tasks will be removed in 4.0, so you should start rewriting any tasks using the celery.decorators module and depending on keyword arguments being passed to the task, for example:
from celery.decorators import task
def add(x, y, task_id=None):
print("My task id is %r" % (task_id, ))
should be rewritten into:
Task attributes
The task attributes:
- queue
- exchange
- exchange_type
- routing_key
- delivery_mode
- priority
is deprecated and must be set by instead.
- BaseAsyncResult -> AsyncResult.
- TaskSetResult -> GroupResult.
- TaskSetResult.total -> len(GroupResult)
- TaskSetResult.taskset_id -> GroupResult.id
Apply to: AsyncResult, :
- Result.task_id() -> Result.id
- Result.status -> Result.state.
- current_loader() -> current_app.loader
- load_settings() -> current_app.conf
The task_sent signal will be removed in version 4.0. Please use the and after_task_publush signals instead.
celery.execute
This module only contains send_task, which must be replaced with celery.send_task instead.
celery.decorators
celery.log
Use instead.
-
Use celery.amqp instead.
celery.registry
Use instead.
celery.task.control
celery.task.schedules
Use celery.schedules instead.
celery.task.chords
Use instead.
- The following settings will be removed:
CELERY_LOADER definitions without class name.
E.g. celery.loaders.default, needs to include the class name: celery.loaders.default.Loader.
TaskSet.run(). Use celery.task.base.TaskSet.apply_async()
instead.
The module celery.task.rest; use celery.task.http instead.