| 1 |
.. _whatsnew-5.1: |
| 2 |
|
| 3 |
========================================= |
| 4 |
What's new in Celery 5.1 (Sun Harmonics) |
| 5 |
========================================= |
| 6 |
:Author: Josue Balandrano Coronel (``jbc at rmcomplexity.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 programming framework |
| 16 |
to process vast amounts of messages, while providing operations with |
| 17 |
the tools required to maintain a distributed system with python. |
| 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 **mostly** backward compatible with previous versions |
| 29 |
it's important that you read the following section as this release |
| 30 |
is a new major version. |
| 31 |
|
| 32 |
This version is officially supported on CPython 3.6, 3.7 & 3.8 & 3.9 |
| 33 |
and is also supported on PyPy3. |
| 34 |
|
| 35 |
.. _`website`: http://celeryproject.org/ |
| 36 |
|
| 37 |
.. topic:: Table of Contents |
| 38 |
|
| 39 |
Make sure you read the important notes before upgrading to this version. |
| 40 |
|
| 41 |
.. contents:: |
| 42 |
:local: |
| 43 |
:depth: 2 |
| 44 |
|
| 45 |
Preface |
| 46 |
======= |
| 47 |
|
| 48 |
The 5.1.0 release is a new minor release for Celery. |
| 49 |
|
| 50 |
Starting from now users should expect more frequent releases of major versions |
| 51 |
as we move fast and break things to bring you even better experience. |
| 52 |
|
| 53 |
Releases in the 5.x series are codenamed after songs of `Jon Hopkins <https://en.wikipedia.org/wiki/Jon_Hopkins>`_. |
| 54 |
This release has been codenamed `Sun Harmonics <https://www.youtube.com/watch?v=pCwjSoBm_pI>`_. |
| 55 |
|
| 56 |
From now on we only support Python 3.6 and above. |
| 57 |
We will maintain compatibility with Python 3.6 until it's |
| 58 |
EOL in December, 2021. |
| 59 |
|
| 60 |
*— Omer Katz* |
| 61 |
|
| 62 |
Long Term Support Policy |
| 63 |
------------------------ |
| 64 |
|
| 65 |
As we'd like to provide some time for you to transition, |
| 66 |
we're designating Celery 4.x an LTS release. |
| 67 |
Celery 4.x will be supported until the 1st of August, 2021. |
| 68 |
|
| 69 |
We will accept and apply patches for bug fixes and security issues. |
| 70 |
However, no new features will be merged for that version. |
| 71 |
|
| 72 |
Celery 5.x **is not** an LTS release. We will support it until the release |
| 73 |
of Celery 6.x. |
| 74 |
|
| 75 |
We're in the process of defining our Long Term Support policy. |
| 76 |
Watch the next "What's New" document for updates. |
| 77 |
|
| 78 |
Wall of Contributors |
| 79 |
-------------------- |
| 80 |
|
| 81 |
0xflotus <[email protected]> |
| 82 |
AbdealiJK <[email protected]> |
| 83 |
Anatoliy <[email protected]> |
| 84 |
Anna Borzenko <[email protected]> |
| 85 |
aruseni <[email protected]> |
| 86 |
Asif Saif Uddin (Auvi) <[email protected]> |
| 87 |
Asif Saif Uddin <[email protected]> |
| 88 |
Awais Qureshi <[email protected]> |
| 89 |
careljonkhout <[email protected]> |
| 90 |
Christian Clauss <[email protected]> |
| 91 |
danthegoodman1 <[email protected]> |
| 92 |
Dave Johansen <[email protected]> |
| 93 |
David Schneider <[email protected]> |
| 94 |
Fahmi <[email protected]> |
| 95 |
Felix Yan <[email protected]> |
| 96 |
Gabriel Augendre <[email protected]> |
| 97 |
galcohen <[email protected]> |
| 98 |
gal cohen <[email protected]> |
| 99 |
Geunsik Lim <[email protected]> |
| 100 |
Guillaume DE SUSANNE D'EPINAY <[email protected]> |
| 101 |
Hilmar Hilmarsson <[email protected]> |
| 102 |
Illia Volochii <[email protected]> |
| 103 |
jenhaoyang <[email protected]> |
| 104 |
Jonathan Stoppani <[email protected]> |
| 105 |
Josue Balandrano Coronel <[email protected]> |
| 106 |
kosarchuksn <[email protected]> |
| 107 |
Kostya Deev <[email protected]> |
| 108 |
Matt Hoffman <[email protected]> |
| 109 |
Matus Valo <[email protected]> |
| 110 |
Myeongseok Seo <[email protected]> |
| 111 |
Noam <[email protected]> |
| 112 |
Omer Katz <[email protected]> |
| 113 |
pavlos kallis <[email protected]> |
| 114 |
Pavol Plaskoň <[email protected]> |
| 115 |
Pengjie Song (宋鹏捷) <[email protected]> |
| 116 |
Sardorbek Imomaliev <[email protected]> |
| 117 |
Sergey Lyapustin <[email protected]> |
| 118 |
Sergey Tikhonov <[email protected]> |
| 119 |
Stephen J. Fuhry <[email protected]> |
| 120 |
Swen Kooij <[email protected]> |
| 121 |
tned73 <[email protected]> |
| 122 |
Tomas Hrnciar <[email protected]> |
| 123 |
tumb1er <[email protected]> |
| 124 |
|
| 125 |
.. note:: |
| 126 |
|
| 127 |
This wall was automatically generated from git history, |
| 128 |
so sadly it doesn't not include the people who help with more important |
| 129 |
things like answering mailing-list questions. |
| 130 |
|
| 131 |
Upgrading from Celery 4.x |
| 132 |
========================= |
| 133 |
|
| 134 |
Step 1: Adjust your command line invocation |
| 135 |
------------------------------------------- |
| 136 |
|
| 137 |
Celery 5.0 introduces a new CLI implementation which isn't completely backwards compatible. |
| 138 |
|
| 139 |
The global options can no longer be positioned after the sub-command. |
| 140 |
Instead, they must be positioned as an option for the `celery` command like so:: |
| 141 |
|
| 142 |
celery --app path.to.app worker |
| 143 |
|
| 144 |
If you were using our :ref:`daemonizing` guide to deploy Celery in production, |
| 145 |
you should revisit it for updates. |
| 146 |
|
| 147 |
Step 2: Update your configuration with the new setting names |
| 148 |
------------------------------------------------------------ |
| 149 |
|
| 150 |
If you haven't already updated your configuration when you migrated to Celery 4.0, |
| 151 |
please do so now. |
| 152 |
|
| 153 |
We elected to extend the deprecation period until 6.0 since |
| 154 |
we did not loudly warn about using these deprecated settings. |
| 155 |
|
| 156 |
Please refer to the :ref:`migration guide <conf-old-settings-map>` for instructions. |
| 157 |
|
| 158 |
Step 3: Read the important notes in this document |
| 159 |
------------------------------------------------- |
| 160 |
|
| 161 |
Make sure you are not affected by any of the important upgrade notes |
| 162 |
mentioned in the :ref:`following section <v500-important>`. |
| 163 |
|
| 164 |
You should verify that none of the breaking changes in the CLI |
| 165 |
do not affect you. Please refer to :ref:`New Command Line Interface <new_command_line_interface>` for details. |
| 166 |
|
| 167 |
Step 4: Migrate your code to Python 3 |
| 168 |
------------------------------------- |
| 169 |
|
| 170 |
Celery 5.x only supports Python 3. Therefore, you must ensure your code is |
| 171 |
compatible with Python 3. |
| 172 |
|
| 173 |
If you haven't ported your code to Python 3, you must do so before upgrading. |
| 174 |
|
| 175 |
You can use tools like `2to3 <https://docs.python.org/3.8/library/2to3.html>`_ |
| 176 |
and `pyupgrade <https://github.com/asottile/pyupgrade>`_ to assist you with |
| 177 |
this effort. |
| 178 |
|
| 179 |
After the migration is done, run your test suite with Celery 4 to ensure |
| 180 |
nothing has been broken. |
| 181 |
|
| 182 |
Step 5: Upgrade to Celery 5.1 |
| 183 |
----------------------------- |
| 184 |
|
| 185 |
At this point you can upgrade your workers and clients with the new version. |
| 186 |
|
| 187 |
.. _v510-important: |
| 188 |
|
| 189 |
Important Notes |
| 190 |
=============== |
| 191 |
|
| 192 |
Supported Python Versions |
| 193 |
------------------------- |
| 194 |
|
| 195 |
The supported Python Versions are: |
| 196 |
|
| 197 |
- CPython 3.6 |
| 198 |
- CPython 3.7 |
| 199 |
- CPython 3.8 |
| 200 |
- CPython 3.9 |
| 201 |
- PyPy3.6 7.2 (``pypy3``) |
| 202 |
|
| 203 |
Important Notes |
| 204 |
--------------- |
| 205 |
|
| 206 |
Kombu |
| 207 |
~~~~~ |
| 208 |
|
| 209 |
Starting from v5.1, the minimum required version is Kombu 5.1.0. |
| 210 |
|
| 211 |
Py-AMQP |
| 212 |
~~~~~~~ |
| 213 |
|
| 214 |
Starting from Celery 5.1, py-amqp will always validate certificates received from the server |
| 215 |
and it is no longer required to manually set ``cert_reqs`` to ``ssl.CERT_REQUIRED``. |
| 216 |
|
| 217 |
The previous default, ``ssl.CERT_NONE`` is insecure and we its usage should be discouraged. |
| 218 |
If you'd like to revert to the previous insecure default set ``cert_reqs`` to ``ssl.CERT_NONE`` |
| 219 |
|
| 220 |
.. code-block:: python |
| 221 |
|
| 222 |
import ssl |
| 223 |
|
| 224 |
broker_use_ssl = { |
| 225 |
'keyfile': '/var/ssl/private/worker-key.pem', |
| 226 |
'certfile': '/var/ssl/amqp-server-cert.pem', |
| 227 |
'ca_certs': '/var/ssl/myca.pem', |
| 228 |
'cert_reqs': ssl.CERT_NONE |
| 229 |
} |
| 230 |
|
| 231 |
Billiard |
| 232 |
~~~~~~~~ |
| 233 |
|
| 234 |
Starting from v5.1, the minimum required version is Billiard 3.6.4. |
| 235 |
|
| 236 |
Important Notes From 5.0 |
| 237 |
------------------------ |
| 238 |
|
| 239 |
Dropped support for Python 2.7 & 3.5 |
| 240 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 241 |
|
| 242 |
Celery now requires Python 3.6 and above. |
| 243 |
|
| 244 |
Python 2.7 has reached EOL in January 2020. |
| 245 |
In order to focus our efforts we have dropped support for Python 2.7 in |
| 246 |
this version. |
| 247 |
|
| 248 |
In addition, Python 3.5 has reached EOL in September 2020. |
| 249 |
Therefore, we are also dropping support for Python 3.5. |
| 250 |
|
| 251 |
If you still require to run Celery using Python 2.7 or Python 3.5 |
| 252 |
you can still use Celery 4.x. |
| 253 |
However we encourage you to upgrade to a supported Python version since |
| 254 |
no further security patches will be applied for Python 2.7 or |
| 255 |
Python 3.5. |
| 256 |
|
| 257 |
Eventlet Workers Pool |
| 258 |
~~~~~~~~~~~~~~~~~~~~~ |
| 259 |
|
| 260 |
Due to `eventlet/eventlet#526 <https://github.com/eventlet/eventlet/issues/526>`_ |
| 261 |
the minimum required version is eventlet 0.26.1. |
| 262 |
|
| 263 |
Gevent Workers Pool |
| 264 |
~~~~~~~~~~~~~~~~~~~ |
| 265 |
|
| 266 |
Starting from v5.0, the minimum required version is gevent 1.0.0. |
| 267 |
|
| 268 |
Couchbase Result Backend |
| 269 |
~~~~~~~~~~~~~~~~~~~~~~~~ |
| 270 |
|
| 271 |
The Couchbase result backend now uses the V3 Couchbase SDK. |
| 272 |
|
| 273 |
As a result, we no longer support Couchbase Server 5.x. |
| 274 |
|
| 275 |
Also, starting from v5.0, the minimum required version |
| 276 |
for the database client is couchbase 3.0.0. |
| 277 |
|
| 278 |
To verify that your Couchbase Server is compatible with the V3 SDK, |
| 279 |
please refer to their `documentation <https://docs.couchbase.com/python-sdk/3.0/project-docs/compatibility.html>`_. |
| 280 |
|
| 281 |
Riak Result Backend |
| 282 |
~~~~~~~~~~~~~~~~~~~ |
| 283 |
|
| 284 |
The Riak result backend has been removed as the database is no longer maintained. |
| 285 |
|
| 286 |
The Python client only supports Python 3.6 and below which prevents us from |
| 287 |
supporting it and it is also unmaintained. |
| 288 |
|
| 289 |
If you are still using Riak, refrain from upgrading to Celery 5.0 while you |
| 290 |
migrate your application to a different database. |
| 291 |
|
| 292 |
We apologize for the lack of notice in advance but we feel that the chance |
| 293 |
you'll be affected by this breaking change is minimal which is why we |
| 294 |
did it. |
| 295 |
|
| 296 |
AMQP Result Backend |
| 297 |
~~~~~~~~~~~~~~~~~~~ |
| 298 |
|
| 299 |
The AMQP result backend has been removed as it was deprecated in version 4.0. |
| 300 |
|
| 301 |
Removed Deprecated Modules |
| 302 |
~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 303 |
|
| 304 |
The `celery.utils.encoding` and the `celery.task` modules has been deprecated |
| 305 |
in version 4.0 and therefore are removed in 5.0. |
| 306 |
|
| 307 |
If you were using the `celery.utils.encoding` module before, |
| 308 |
you should import `kombu.utils.encoding` instead. |
| 309 |
|
| 310 |
If you were using the `celery.task` module before, you should import directly |
| 311 |
from the `celery` module instead. |
| 312 |
|
| 313 |
If you were using `from celery.task import Task` you should use |
| 314 |
`from celery import Task` instead. |
| 315 |
|
| 316 |
If you were using the `celery.task` decorator you should use |
| 317 |
`celery.shared_task` instead. |
| 318 |
|
| 319 |
|
| 320 |
`azure-servicebus` 7.0.0 is now required |
| 321 |
---------------------------------------- |
| 322 |
|
| 323 |
Given the SDK changes between 0.50.0 and 7.0.0 Kombu deprecates support for |
| 324 |
older `azure-servicebus` versions. |
| 325 |
|
| 326 |
.. _v510-news: |
| 327 |
|
| 328 |
News |
| 329 |
==== |
| 330 |
|
| 331 |
Support for Azure Service Bus 7.0.0 |
| 332 |
----------------------------------- |
| 333 |
|
| 334 |
With Kombu v5.1.0 we now support Azure Services Bus. |
| 335 |
|
| 336 |
Azure have completely changed the Azure ServiceBus SDK between 0.50.0 and 7.0.0. |
| 337 |
`azure-servicebus >= 7.0.0` is now required for Kombu `5.1.0` |
| 338 |
|
| 339 |
Add support for SQLAlchemy 1.4 |
| 340 |
------------------------------ |
| 341 |
|
| 342 |
Following the changes in SQLAlchemy 1.4, the declarative base is no |
| 343 |
longer an extension. |
| 344 |
Importing it from sqlalchemy.ext.declarative is deprecated and will |
| 345 |
be removed in SQLAlchemy 2.0. |
| 346 |
|
| 347 |
Support for Redis username authentication |
| 348 |
----------------------------------------- |
| 349 |
|
| 350 |
Previously, the username was ignored from the URI. |
| 351 |
Starting from Redis>=6.0, that shouldn't be the case since ACL support has landed. |
| 352 |
|
| 353 |
Please refer to the :ref:`documentation <conf-redis-result-backend>` for details. |
| 354 |
|
| 355 |
SQS transport - support back off policy |
| 356 |
---------------------------------------- |
| 357 |
|
| 358 |
SQS now supports managed visibility timeout. This lets us implement a back off |
| 359 |
policy (for instance, an exponential policy) which means that the time between |
| 360 |
task failures will dynamically change based on the number of retries. |
| 361 |
|
| 362 |
Documentation: :doc:`kombu:reference/kombu.transport.SQS` |
| 363 |
|
| 364 |
Duplicate successful tasks |
| 365 |
--------------------------- |
| 366 |
|
| 367 |
The trace function fetches the metadata from the backend each time it |
| 368 |
receives a task and compares its state. If the state is SUCCESS, |
| 369 |
we log and bail instead of executing the task. |
| 370 |
The task is acknowledged and everything proceeds normally. |
| 371 |
|
| 372 |
Documentation: :setting:`worker_deduplicate_successful_tasks` |
| 373 |
|
| 374 |
Terminate tasks with late acknowledgment on connection loss |
| 375 |
----------------------------------------------------------- |
| 376 |
|
| 377 |
Tasks with late acknowledgement keep running after restart, |
| 378 |
although the connection is lost and they cannot be |
| 379 |
acknowledged anymore. These tasks will now be terminated. |
| 380 |
|
| 381 |
Documentation: :setting:`worker_cancel_long_running_tasks_on_connection_loss` |
| 382 |
|
| 383 |
`task.apply_async(ignore_result=True)` now avoids persisting the result |
| 384 |
----------------------------------------------------------------------- |
| 385 |
|
| 386 |
`task.apply_async` now supports passing `ignore_result` which will act the same |
| 387 |
as using ``@app.task(ignore_result=True)``. |
| 388 |
|
| 389 |
Use a thread-safe implementation of `cached_property` |
| 390 |
----------------------------------------------------- |
| 391 |
|
| 392 |
`cached_property` is heavily used in celery but it is causing |
| 393 |
issues in multi-threaded code since it is not thread safe. |
| 394 |
Celery is now using a thread-safe implementation of `cached_property`. |
| 395 |
|
| 396 |
Tasks can now have required kwargs at any order |
| 397 |
------------------------------------------------ |
| 398 |
|
| 399 |
Tasks can now be defined like this: |
| 400 |
|
| 401 |
.. code-block:: python |
| 402 |
|
| 403 |
from celery import shared_task |
| 404 |
|
| 405 |
@shared_task |
| 406 |
def my_func(*, name='default', age, city='Kyiv'): |
| 407 |
pass |
| 408 |
|
| 409 |
|
| 410 |
SQS - support STS authentication with AWS |
| 411 |
----------------------------------------- |
| 412 |
|
| 413 |
The STS token requires a refresh after a certain period of time. |
| 414 |
After `sts_token_timeout` is reached, a new token will be created. |
| 415 |
|
| 416 |
Documentation: :doc:`/getting-started/backends-and-brokers/sqs` |
| 417 |
|
| 418 |
Support Redis `health_check_interval` |
| 419 |
------------------------------------- |
| 420 |
|
| 421 |
`health_check_interval` can be configured and will be passed to `redis-py`. |
| 422 |
|
| 423 |
Documentation: :setting:`redis_backend_health_check_interval` |
| 424 |
|
| 425 |
|
| 426 |
Update default pickle protocol version to 4 |
| 427 |
-------------------------------------------- |
| 428 |
|
| 429 |
The pickle protocol version was updated to allow Celery to serialize larger |
| 430 |
strings among other benefits. |
| 431 |
|
| 432 |
See: https://docs.python.org/3.9/library/pickle.html#data-stream-format |
| 433 |
|
| 434 |
|
| 435 |
Support Redis Sentinel with SSL |
| 436 |
------------------------------- |
| 437 |
|
| 438 |
See documentation for more info: |
| 439 |
:doc:`/getting-started/backends-and-brokers/redis` |