Debian Codegraph @

docs/history/whatsnew-4.3.rst

raw
1 .. _whatsnew-4.3:
2
3 ===================================
4 What's new in Celery 4.3 (rhubarb)
5 ===================================
6 :Author: Omer Katz (``omer.drow at gmail.com``)
7
8 .. sidebar:: Change history
9
10 What's new documents describe the changes in major versions,
11 we also have a :ref:`changelog` that lists the changes in bugfix
12 releases (0.0.x), while older series are archived under the :ref:`history`
13 section.
14
15 Celery is a simple, flexible, and reliable distributed system to
16 process vast amounts of messages, while providing operations with
17 the tools required to maintain such a system.
18
19 It's a task queue with focus on real-time processing, while also
20 supporting task scheduling.
21
22 Celery has a large and diverse community of users and contributors,
23 you should come join us :ref:`on IRC <irc-channel>`
24 or :ref:`our mailing-list <mailing-list>`.
25
26 To read more about Celery you should go read the :ref:`introduction <intro>`.
27
28 While this version is backward compatible with previous versions
29 it's important that you read the following section.
30
31 This version is officially supported on CPython 2.7, 3.4, 3.5, 3.6 & 3.7
32 and is also supported on PyPy2 & PyPy3.
33
34 .. _`website`: http://celeryproject.org/
35
36 .. topic:: Table of Contents
37
38 Make sure you read the important notes before upgrading to this version.
39
40 .. contents::
41 :local:
42 :depth: 2
43
44 Preface
45 =======
46
47 The 4.3.0 release continues to improve our efforts to provide you with
48 the best task execution platform for Python.
49
50 This release has been codenamed `Rhubarb <https://www.youtube.com/watch?v=_AWIqXzvX-U>`_
51 which is one of my favorite tracks from Selected Ambient Works II.
52
53 This release focuses on new features like new result backends
54 and a revamped security serializer along with bug fixes mainly for Celery Beat,
55 Canvas, a number of critical fixes for hanging workers and
56 fixes for several severe memory leaks.
57
58 Celery 4.3 is the first release to support Python 3.7.
59
60 We hope that 4.3 will be the last release to support Python 2.7 as we now
61 begin to work on Celery 5, the next generation of our task execution platform.
62
63 However, if Celery 5 will be delayed for any reason we may release
64 another 4.x minor version which will still support Python 2.7.
65
66 If another 4.x version will be released it will most likely drop support for
67 Python 3.4 as it will reach it's EOL in March 2019.
68
69 We have also focused on reducing contribution friction.
70
71 Thanks to **Josue Balandrano Coronel**, one of our core contributors, we now have an
72 updated :ref:`contributing` document.
73 If you intend to contribute, please review it at your earliest convenience.
74
75 I have also added new issue templates, which we will continue to improve,
76 so that the issues you open will have more relevant information which
77 will allow us to help you to resolve them more easily.
78
79 *— Omer Katz*
80
81 Wall of Contributors
82 --------------------
83
84
85 Alexander Ioannidis <[email protected]>
86 Amir Hossein Saeid Mehr <[email protected]>
87 Andrea Rabbaglietti <[email protected]>
88 Andrey Skabelin <[email protected]>
89 Anthony Ruhier <[email protected]>
90 Antonin Delpeuch <[email protected]>
91 Artem Vasilyev <[email protected]>
92 Asif Saif Uddin (Auvi) <[email protected]>
93 aviadatsnyk <[email protected]>
94 Axel Haustant <[email protected]>
95 Bojan Jovanovic <[email protected]>
96 Brett Jackson <[email protected]>
97 Brett Randall <[email protected]>
98 Brian Schrader <[email protected]>
99 Bruno Alla <[email protected]>
100 Buddy <[email protected]>
101 Charles Chan <[email protected]>
102 Christopher Dignam <[email protected]>
103 Ciaran Courtney <[email protected]>
104 Clemens Wolff <[email protected]>
105 Colin Watson <[email protected]>
106 Daniel Hahler <[email protected]>
107 Dash Winterson <[email protected]>
108 Derek Harland <[email protected]>
109 Dilip Vamsi Moturi <[email protected]>
110 Dmytro Litvinov <[email protected]>
111 Douglas Rohde <[email protected]>
112 Ed Morley <[email protected]>
113 Fabian Becker <[email protected]>
114 Federico Bond <[email protected]>
115 Fengyuan Chen <[email protected]>
116 Florian CHARDIN <[email protected]>
117 George Psarakis <[email protected]>
118 Guilherme Caminha <[email protected]>
119 ideascf <[email protected]>
120 Itay <[email protected]>
121 Jamie Alessio <[email protected]>
122 Jason Held <[email protected]>
123 Jeremy Cohen <[email protected]>
124 John Arnold <[email protected]>
125 Jon Banafato <[email protected]>
126 Jon Dufresne <[email protected]>
127 Joshua Engelman <[email protected]>
128 Joshua Schmid <[email protected]>
129 Josue Balandrano Coronel <[email protected]>
130 K Davis <[email protected]>
131 kidoz <[email protected]>
132 Kiyohiro Yamaguchi <[email protected]>
133 Korijn van Golen <[email protected]>
134 Lars Kruse <[email protected]>
135 Lars Rinn <[email protected]>
136 Lewis M. Kabui <[email protected]>
137 madprogrammer <[email protected]>
138 Manuel Vázquez Acosta <[email protected]>
139 Marcus McHale <[email protected]>
140 Mariatta <[email protected]>
141 Mario Kostelac <[email protected]>
142 Matt Wiens <[email protected]>
143 Maximilien Cuony <[email protected]>
144 Maximilien de Bayser <[email protected]>
145 Meysam <[email protected]>
146 Milind Shakya <[email protected]>
147 na387 <[email protected]>
148 Nicholas Pilon <[email protected]>
149 Nick Parsons <[email protected]>
150 Nik Molnar <[email protected]>
151 Noah Hall <[email protected]>
152 Noam <[email protected]>
153 Omer Katz <[email protected]>
154 Paweł Adamczak <[email protected]>
155 peng weikang <[email protected]>
156 Prathamesh Salunkhe <[email protected]>
157 Przemysław Suliga <[email protected]>
158 Raf Geens <[email protected]>
159 (◕ᴥ◕) <[email protected]>
160 Robert Kopaczewski <[email protected]>
161 Samuel Huang <[email protected]>
162 Sebastian Wojciechowski <[email protected]>
163 Seunghun Lee <[email protected]>
164 Shanavas M <[email protected]>
165 Simon Charette <[email protected]>
166 Simon Schmidt <[email protected]>
167 srafehi <[email protected]>
168 Steven Sklar <[email protected]>
169 Tom Booth <[email protected]>
170 Tom Clancy <[email protected]>
171 Toni Ruža <[email protected]>
172 tothegump <[email protected]>
173 Victor Mireyev <[email protected]>
174 Vikas Prasad <[email protected]>
175 walterqian <[email protected]>
176 Willem <[email protected]>
177 Xiaodong <[email protected]>
178 yywing <[email protected]>
179
180 .. note::
181
182 This wall was automatically generated from git history,
183 so sadly it doesn't not include the people who help with more important
184 things like answering mailing-list questions.
185
186
187 Upgrading from Celery 4.2
188 =========================
189
190 Please read the important notes below as there are several breaking changes.
191
192 .. _v430-important:
193
194 Important Notes
195 ===============
196
197 Supported Python Versions
198 -------------------------
199
200 The supported Python Versions are:
201
202 - CPython 2.7
203 - CPython 3.4
204 - CPython 3.5
205 - CPython 3.6
206 - CPython 3.7
207 - PyPy2.7 6.0 (``pypy2``)
208 - PyPy3.5 6.0 (``pypy3``)
209
210 Kombu
211 -----
212
213 Starting from this release, the minimum required version is Kombu 4.4.
214
215 New Compression Algorithms
216 ~~~~~~~~~~~~~~~~~~~~~~~~~~
217
218 Kombu 4.3 includes a few new optional compression methods:
219
220 - LZMA (available from stdlib if using Python 3 or from a backported package)
221 - Brotli (available if you install either the brotli or the brotlipy package)
222 - ZStandard (available if you install the zstandard package)
223
224 Unfortunately our current protocol generates huge payloads for complex canvases.
225
226 Until we migrate to our 3rd revision of the Celery protocol in Celery 5
227 which will resolve this issue, please use one of the new compression methods
228 as a workaround.
229
230 See :ref:`calling-compression` for details.
231
232 Billiard
233 --------
234
235 Starting from this release, the minimum required version is Billiard 3.6.
236
237 Eventlet Workers Pool
238 ---------------------
239
240 We now require `eventlet>=0.24.1`.
241
242 If you are using the eventlet workers pool please install Celery using:
243
244 .. code-block:: console
245
246 $ pip install -U celery[eventlet]
247
248 MessagePack Serializer
249 ----------------------
250
251 We've been using the deprecated `msgpack-python` package for a while.
252 This is now fixed as we depend on the `msgpack` instead.
253
254 If you are currently using the MessagePack serializer please uninstall the
255 previous package and reinstall the new one using:
256
257 .. code-block:: console
258
259 $ pip uninstall msgpack-python -y
260 $ pip install -U celery[msgpack]
261
262 MongoDB Result Backend
263 -----------------------
264
265 We now support the `DNS seedlist connection format <https://docs.mongodb.com/manual/reference/connection-string/#dns-seedlist-connection-format>`_ for the MongoDB result backend.
266
267 This requires the `dnspython` package.
268
269 If you are using the MongoDB result backend please install Celery using:
270
271 .. code-block:: console
272
273 $ pip install -U celery[mongodb]
274
275 Redis Message Broker
276 --------------------
277
278 Due to multiple bugs in earlier versions of py-redis that were causing
279 issues for Celery, we were forced to bump the minimum required version to 3.2.0.
280
281 Redis Result Backend
282 --------------------
283
284 Due to multiple bugs in earlier versions of py-redis that were causing
285 issues for Celery, we were forced to bump the minimum required version to 3.2.0.
286
287 Riak Result Backend
288 --------------------
289
290 The official Riak client does not support Python 3.7 as of yet.
291
292 In case you are using the Riak result backend, either attempt to install the
293 client from master or avoid upgrading to Python 3.7 until this matter is resolved.
294
295 In case you are using the Riak result backend with Python 3.7, we now emit
296 a warning.
297
298 Please track `basho/riak-python-client#534 <https://github.com/basho/riak-python-client/issues/534>`_
299 for updates.
300
301 Dropped Support for RabbitMQ 2.x
302 --------------------------------
303
304 Starting from this release, we officially no longer support RabbitMQ 2.x.
305
306 The last release of 2.x was in 2012 and we had to make adjustments to
307 correctly support high availability on RabbitMQ 3.x.
308
309 If for some reason, you are still using RabbitMQ 2.x we encourage you to upgrade
310 as soon as possible since security patches are no longer applied on RabbitMQ 2.x.
311
312 Django Support
313 --------------
314
315 Starting from this release, the minimum required Django version is 1.11.
316
317 Revamped auth Serializer
318 ------------------------
319
320 The auth serializer received a complete overhaul.
321 It was previously horribly broken.
322
323 We now depend on `cryptography` instead of `pyOpenSSL` for this serializer.
324
325 See :ref:`message-signing` for details.
326
327 .. _v430-news:
328
329 News
330 ====
331
332 Brokers
333 -------
334
335 Redis Broker Support for SSL URIs
336 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
337
338 The Redis broker now has support for SSL connections.
339
340 You can use :setting:`broker_use_ssl` as you normally did and use a
341 `rediss://` URI.
342
343 You can also pass the SSL configuration parameters to the URI:
344
345 `rediss://localhost:3456?ssl_keyfile=keyfile.key&ssl_certfile=certificate.crt&ssl_ca_certs=ca.pem&ssl_cert_reqs=CERT_REQUIRED`
346
347 Configurable Events Exchange Name
348 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
349
350 Previously, the events exchange name was hardcoded.
351
352 You can use :setting:`event_exchange` to determine it.
353 The default value remains the same.
354
355 Configurable Pidbox Exchange Name
356 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
357
358 Previously, the Pidbox exchange name was hardcoded.
359
360 You can use :setting:`control_exchange` to determine it.
361 The default value remains the same.
362
363 Result Backends
364 ---------------
365
366 Redis Result Backend Support for SSL URIs
367 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
368
369 The Redis result backend now has support for SSL connections.
370
371 You can use :setting:`redis_backend_use_ssl` to configure it and use a
372 `rediss://` URI.
373
374 You can also pass the SSL configuration parameters to the URI:
375
376 `rediss://localhost:3456?ssl_keyfile=keyfile.key&ssl_certfile=certificate.crt&ssl_ca_certs=ca.pem&ssl_cert_reqs=CERT_REQUIRED`
377
378
379 Store Extended Task Metadata in Result
380 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
381
382 When :setting:`result_extended` is `True` the backend will store the following
383 metadata:
384
385 - Task Name
386 - Arguments
387 - Keyword arguments
388 - The worker the task was executed on
389 - Number of retries
390 - The queue's name or routing key
391
392 In addition, :meth:`celery.app.task.update_state` now accepts keyword arguments
393 which allows you to store custom data with the result.
394
395 Encode Results Using A Different Serializer
396 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
397
398 The :setting:`result_accept_content` setting allows to configure different
399 accepted content for the result backend.
400
401 A special serializer (`auth`) is used for signed messaging,
402 however the result_serializer remains in json, because we don't want encrypted
403 content in our result backend.
404
405 To accept unsigned content from the result backend,
406 we introduced this new configuration option to specify the
407 accepted content from the backend.
408
409 New Result Backends
410 ~~~~~~~~~~~~~~~~~~~
411
412 This release introduces four new result backends:
413
414 - S3 result backend
415 - ArangoDB result backend
416 - Azure Block Blob Storage result backend
417 - CosmosDB result backend
418
419 S3 Result Backend
420 ~~~~~~~~~~~~~~~~~
421
422 Amazon Simple Storage Service (Amazon S3) is an object storage service by AWS.
423
424 The results are stored using the following path template:
425
426 | <:setting:`s3_bucket`>/<:setting:`s3_base_path`>/<key>
427
428 See :ref:`conf-s3-result-backend` for more information.
429
430 ArangoDB Result Backend
431 ~~~~~~~~~~~~~~~~~~~~~~~
432
433 ArangoDB is a native multi-model database with search capabilities.
434 The backend stores the result in the following document format:
435
436
437 | {
438 | _key: {key},
439 | task: {task}
440 | }
441
442 See :ref:`conf-arangodb-result-backend` for more information.
443
444 Azure Block Blob Storage Result Backend
445 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
446
447 Azure Block Blob Storage is an object storage service by Microsoft.
448
449 The backend stores the result in the following path template:
450
451 | <:setting:`azureblockblob_container_name`>/<key>
452
453 See :ref:`conf-azureblockblob-result-backend` for more information.
454
455 CosmosDB Result Backend
456 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
457
458 Azure Cosmos DB is Microsoft's globally distributed,
459 multi-model database service.
460
461 The backend stores the result in the following document format:
462
463 | {
464 | id: {key},
465 | value: {task}
466 | }
467
468 See :ref:`conf-cosmosdbsql-result-backend` for more information.
469
470 Tasks
471 -----
472
473 Cythonized Tasks
474 ~~~~~~~~~~~~~~~~
475
476 Cythonized tasks are now supported.
477 You can generate C code from Cython that specifies a task using the `@task`
478 decorator and everything should work exactly the same.
479
480 Acknowledging Tasks on Failures or Timeouts
481 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
482
483 When :setting:`task_acks_late` is set to `True` tasks are acknowledged on failures or
484 timeouts.
485 This makes it hard to use dead letter queues and exchanges.
486
487 Celery 4.3 introduces the new :setting:`task_acks_on_failure_or_timeout` which
488 allows you to avoid acknowledging tasks if they failed or timed out even if
489 :setting:`task_acks_late` is set to `True`.
490
491 :setting:`task_acks_on_failure_or_timeout` is set to `True` by default.
492
493 Schedules Now Support Microseconds
494 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
495
496 When scheduling tasks using :program:`celery beat` microseconds
497 are no longer ignored.
498
499 Default Task Priority
500 ~~~~~~~~~~~~~~~~~~~~~
501
502 You can now set the default priority of a task using
503 the :setting:`task_default_priority` setting.
504 The setting's value will be used if no priority is provided for a specific
505 task.
506
507 Tasks Optionally Inherit Parent's Priority
508 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
509
510 Setting the :setting:`task_inherit_parent_priority` configuration option to
511 `True` will make Celery tasks inherit the priority of the previous task
512 linked to it.
513
514 Examples:
515
516 .. code-block:: python
517
518 c = celery.chain(
519 add.s(2), # priority=None
520 add.s(3).set(priority=5), # priority=5
521 add.s(4), # priority=5
522 add.s(5).set(priority=3), # priority=3
523 add.s(6), # priority=3
524 )
525
526 .. code-block:: python
527
528 @app.task(bind=True)
529 def child_task(self):
530 pass
531
532 @app.task(bind=True)
533 def parent_task(self):
534 child_task.delay()
535
536 # child_task will also have priority=5
537 parent_task.apply_async(args=[], priority=5)
538
539 Canvas
540 ------
541
542 Chords can be Executed in Eager Mode
543 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
544
545 When :setting:`task_always_eager` is set to `True`, chords are executed eagerly
546 as well.
547
548 Configurable Chord Join Timeout
549 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
550
551 Previously, :meth:`celery.result.GroupResult.join` had a fixed timeout of 3
552 seconds.
553
554 The :setting:`result_chord_join_timeout` setting now allows you to change it.
555
556 The default remains 3 seconds.