Debian Codegraph @

docs/internals/deprecation.rst

raw
1 .. _deprecation-timeline:
2
3 ==============================
4 Celery Deprecation Time-line
5 ==============================
6
7 .. contents::
8 :local:
9
10 .. _deprecations-v5.0:
11
12 Removals for version 5.0
13 ========================
14
15 Old Task API
16 ------------
17
18 .. _deprecate-compat-task-modules:
19
20 Compat Task Modules
21 ~~~~~~~~~~~~~~~~~~~
22
23 - Module ``celery.decorators`` will be removed:
24
25 This means you need to change:
26
27 .. code-block:: python
28
29 from celery.decorators import task
30
31 Into:
32
33 .. code-block:: python
34
35 from celery import task
36
37 - Module ``celery.task`` will be removed
38
39 This means you should change:
40
41 .. code-block:: python
42
43 from celery.task import task
44
45 into:
46
47 .. code-block:: python
48
49 from celery import shared_task
50
51 -- and:
52
53 .. code-block:: python
54
55 from celery import task
56
57 into:
58
59 .. code-block:: python
60
61 from celery import shared_task
62
63 -- and:
64
65 .. code-block:: python
66
67 from celery.task import Task
68
69 into:
70
71 .. code-block:: python
72
73 from celery import Task
74
75
76 Note that the new :class:`~celery.Task` class no longer
77 uses :func:`classmethod` for these methods:
78
79 - delay
80 - apply_async
81 - retry
82 - apply
83 - AsyncResult
84 - subtask
85
86 This also means that you can't call these methods directly
87 on the class, but have to instantiate the task first:
88
89 .. code-block:: pycon
90
91 >>> MyTask.delay() # NO LONGER WORKS
92
93
94 >>> MyTask().delay() # WORKS!
95
96
97 Task attributes
98 ---------------
99
100 The task attributes:
101
102 - ``queue``
103 - ``exchange``
104 - ``exchange_type``
105 - ``routing_key``
106 - ``delivery_mode``
107 - ``priority``
108
109 is deprecated and must be set by :setting:`task_routes` instead.
110
111
112 Modules to Remove
113 -----------------
114
115 - ``celery.execute``
116
117 This module only contains ``send_task``: this must be replaced with
118 :attr:`@send_task` instead.
119
120 - ``celery.decorators``
121
122 See :ref:`deprecate-compat-task-modules`
123
124 - ``celery.log``
125
126 Use :attr:`@log` instead.
127
128 - ``celery.messaging``
129
130 Use :attr:`@amqp` instead.
131
132 - ``celery.registry``
133
134 Use :mod:`celery.app.registry` instead.
135
136 - ``celery.task.control``
137
138 Use :attr:`@control` instead.
139
140 - ``celery.task.schedules``
141
142 Use :mod:`celery.schedules` instead.
143
144 - ``celery.task.chords``
145
146 Use :func:`celery.chord` instead.
147
148 Settings
149 --------
150
151 ``BROKER`` Settings
152 ~~~~~~~~~~~~~~~~~~~
153
154 ===================================== =====================================
155 **Setting name** **Replace with**
156 ===================================== =====================================
157 ``BROKER_HOST`` :setting:`broker_url`
158 ``BROKER_PORT`` :setting:`broker_url`
159 ``BROKER_USER`` :setting:`broker_url`
160 ``BROKER_PASSWORD`` :setting:`broker_url`
161 ``BROKER_VHOST`` :setting:`broker_url`
162 ===================================== =====================================
163
164 ``REDIS`` Result Backend Settings
165 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
166
167 ===================================== =====================================
168 **Setting name** **Replace with**
169 ===================================== =====================================
170 ``CELERY_REDIS_HOST`` :setting:`result_backend`
171 ``CELERY_REDIS_PORT`` :setting:`result_backend`
172 ``CELERY_REDIS_DB`` :setting:`result_backend`
173 ``CELERY_REDIS_PASSWORD`` :setting:`result_backend`
174 ``REDIS_HOST`` :setting:`result_backend`
175 ``REDIS_PORT`` :setting:`result_backend`
176 ``REDIS_DB`` :setting:`result_backend`
177 ``REDIS_PASSWORD`` :setting:`result_backend`
178 ===================================== =====================================
179
180
181 Task_sent signal
182 ----------------
183
184 The :signal:`task_sent` signal will be removed in version 4.0.
185 Please use the :signal:`before_task_publish` and :signal:`after_task_publish`
186 signals instead.
187
188 Result
189 ------
190
191 Apply to: :class:`~celery.result.AsyncResult`,
192 :class:`~celery.result.EagerResult`:
193
194 - ``Result.wait()`` -> ``Result.get()``
195
196 - ``Result.task_id()`` -> ``Result.id``
197
198 - ``Result.status`` -> ``Result.state``.
199
200 .. _deprecations-v3.1:
201
202
203 Settings
204 ~~~~~~~~
205
206 ===================================== =====================================
207 **Setting name** **Replace with**
208 ===================================== =====================================
209 ``CELERY_AMQP_TASK_RESULT_EXPIRES`` :setting:`result_expires`
210 ===================================== =====================================
211
212
213
214 .. _deprecations-v2.0:
215
216 Removals for version 2.0
217 ========================
218
219 * The following settings will be removed:
220
221 ===================================== =====================================
222 **Setting name** **Replace with**
223 ===================================== =====================================
224 `CELERY_AMQP_CONSUMER_QUEUES` `task_queues`
225 `CELERY_AMQP_CONSUMER_QUEUES` `task_queues`
226 `CELERY_AMQP_EXCHANGE` `task_default_exchange`
227 `CELERY_AMQP_EXCHANGE_TYPE` `task_default_exchange_type`
228 `CELERY_AMQP_CONSUMER_ROUTING_KEY` `task_queues`
229 `CELERY_AMQP_PUBLISHER_ROUTING_KEY` `task_default_routing_key`
230 ===================================== =====================================
231
232 * :envvar:`CELERY_LOADER` definitions without class name.
233
234 For example,, `celery.loaders.default`, needs to include the class name:
235 `celery.loaders.default.Loader`.
236
237 * :meth:`TaskSet.run`. Use :meth:`celery.task.base.TaskSet.apply_async`
238 instead.