deprecation.rst 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. .. _deprecation-timeline:
  2. ==============================
  3. Celery Deprecation Time-line
  4. ==============================
  5. .. contents::
  6. :local:
  7. .. _deprecations-v5.0:
  8. Removals for version 5.0
  9. ========================
  10. Old Task API
  11. ------------
  12. .. _deprecate-compat-task-modules:
  13. Compat Task Modules
  14. ~~~~~~~~~~~~~~~~~~~
  15. - Module ``celery.decorators`` will be removed:
  16. This means you need to change:
  17. .. code-block:: python
  18. from celery.decorators import task
  19. Into:
  20. .. code-block:: python
  21. from celery import task
  22. - Module ``celery.task`` *may* be removed (not decided)
  23. This means you should change:
  24. .. code-block:: python
  25. from celery.task import task
  26. into:
  27. .. code-block:: python
  28. from celery import task
  29. -- and:
  30. .. code-block:: python
  31. from celery.task import Task
  32. into:
  33. .. code-block:: python
  34. from celery import Task
  35. Note that the new :class:`~celery.Task` class no longer
  36. uses :func:`classmethod` for these methods:
  37. - delay
  38. - apply_async
  39. - retry
  40. - apply
  41. - AsyncResult
  42. - subtask
  43. This also means that you can't call these methods directly
  44. on the class, but have to instantiate the task first:
  45. .. code-block:: pycon
  46. >>> MyTask.delay() # NO LONGER WORKS
  47. >>> MyTask().delay() # WORKS!
  48. Task attributes
  49. ---------------
  50. The task attributes:
  51. - ``queue``
  52. - ``exchange``
  53. - ``exchange_type``
  54. - ``routing_key``
  55. - ``delivery_mode``
  56. - ``priority``
  57. is deprecated and must be set by :setting:`task_routes` instead.
  58. Modules to Remove
  59. -----------------
  60. - ``celery.execute``
  61. This module only contains ``send_task``: this must be replaced with
  62. :attr:`@send_task` instead.
  63. - ``celery.decorators``
  64. See :ref:`deprecate-compat-task-modules`
  65. - ``celery.log``
  66. Use :attr:`@log` instead.
  67. - ``celery.messaging``
  68. Use :attr:`@amqp` instead.
  69. - ``celery.registry``
  70. Use :mod:`celery.app.registry` instead.
  71. - ``celery.task.control``
  72. Use :attr:`@control` instead.
  73. - ``celery.task.schedules``
  74. Use :mod:`celery.schedules` instead.
  75. - ``celery.task.chords``
  76. Use :func:`celery.chord` instead.
  77. Settings
  78. --------
  79. ``BROKER`` Settings
  80. ~~~~~~~~~~~~~~~~~~~
  81. ===================================== =====================================
  82. **Setting name** **Replace with**
  83. ===================================== =====================================
  84. ``BROKER_HOST`` :setting:`broker_url`
  85. ``BROKER_PORT`` :setting:`broker_url`
  86. ``BROKER_USER`` :setting:`broker_url`
  87. ``BROKER_PASSWORD`` :setting:`broker_url`
  88. ``BROKER_VHOST`` :setting:`broker_url`
  89. ===================================== =====================================
  90. ``REDIS`` Result Backend Settings
  91. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  92. ===================================== =====================================
  93. **Setting name** **Replace with**
  94. ===================================== =====================================
  95. ``CELERY_REDIS_HOST`` :setting:`result_backend`
  96. ``CELERY_REDIS_PORT`` :setting:`result_backend`
  97. ``CELERY_REDIS_DB`` :setting:`result_backend`
  98. ``CELERY_REDIS_PASSWORD`` :setting:`result_backend`
  99. ``REDIS_HOST`` :setting:`result_backend`
  100. ``REDIS_PORT`` :setting:`result_backend`
  101. ``REDIS_DB`` :setting:`result_backend`
  102. ``REDIS_PASSWORD`` :setting:`result_backend`
  103. ===================================== =====================================
  104. Task_sent signal
  105. ----------------
  106. The :signal:`task_sent` signal will be removed in version 4.0.
  107. Please use the :signal:`before_task_publish` and :signal:`after_task_publish`
  108. signals instead.
  109. Result
  110. ------
  111. Apply to: :class:`~celery.result.AsyncResult`,
  112. :class:`~celery.result.EagerResult`:
  113. - ``Result.wait()`` -> ``Result.get()``
  114. - ``Result.task_id()`` -> ``Result.id``
  115. - ``Result.status`` -> ``Result.state``.
  116. .. _deprecations-v3.1:
  117. Settings
  118. ~~~~~~~~
  119. ===================================== =====================================
  120. **Setting name** **Replace with**
  121. ===================================== =====================================
  122. ``CELERY_AMQP_TASK_RESULT_EXPIRES`` :setting:`result_expires`
  123. ===================================== =====================================
  124. .. _deprecations-v2.0:
  125. Removals for version 2.0
  126. ========================
  127. * The following settings will be removed:
  128. ===================================== =====================================
  129. **Setting name** **Replace with**
  130. ===================================== =====================================
  131. `CELERY_AMQP_CONSUMER_QUEUES` `task_queues`
  132. `CELERY_AMQP_CONSUMER_QUEUES` `task_queues`
  133. `CELERY_AMQP_EXCHANGE` `task_default_exchange`
  134. `CELERY_AMQP_EXCHANGE_TYPE` `task_default_exchange_type`
  135. `CELERY_AMQP_CONSUMER_ROUTING_KEY` `task_queues`
  136. `CELERY_AMQP_PUBLISHER_ROUTING_KEY` `task_default_routing_key`
  137. ===================================== =====================================
  138. * :envvar:`CELERY_LOADER` definitions without class name.
  139. For example,, `celery.loaders.default`, needs to include the class name:
  140. `celery.loaders.default.Loader`.
  141. * :meth:`TaskSet.run`. Use :meth:`celery.task.base.TaskSet.apply_async`
  142. instead.