| 1 |
.. _whatsnew-5.0: |
| 2 |
|
| 3 |
======================================= |
| 4 |
What's new in Celery 5.0 (singularity) |
| 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 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 |
| 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.0.0 release is a new major 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 `Singularity <https://www.youtube.com/watch?v=lkvnpHFajt0>`_. |
| 55 |
|
| 56 |
This version drops support for Python 2.7.x which has reached EOL |
| 57 |
in January 1st, 2020. |
| 58 |
This allows us, the maintainers to focus on innovating without worrying |
| 59 |
for backwards compatibility. |
| 60 |
|
| 61 |
From now on we only support Python 3.6 and above. |
| 62 |
We will maintain compatibility with Python 3.6 until it's |
| 63 |
EOL in December, 2021. |
| 64 |
|
| 65 |
*— Omer Katz* |
| 66 |
|
| 67 |
Long Term Support Policy |
| 68 |
------------------------ |
| 69 |
|
| 70 |
As we'd like to provide some time for you to transition, |
| 71 |
we're designating Celery 4.x an LTS release. |
| 72 |
Celery 4.x will be supported until the 1st of August, 2021. |
| 73 |
|
| 74 |
We will accept and apply patches for bug fixes and security issues. |
| 75 |
However, no new features will be merged for that version. |
| 76 |
|
| 77 |
Celery 5.x **is not** an LTS release. We will support it until the release |
| 78 |
of Celery 6.x. |
| 79 |
|
| 80 |
We're in the process of defining our Long Term Support policy. |
| 81 |
Watch the next "What's New" document for updates. |
| 82 |
|
| 83 |
Wall of Contributors |
| 84 |
-------------------- |
| 85 |
|
| 86 |
Artem Vasilyev <[email protected]> |
| 87 |
Ash Berlin-Taylor <[email protected]> |
| 88 |
Asif Saif Uddin (Auvi) <[email protected]> |
| 89 |
Asif Saif Uddin <[email protected]> |
| 90 |
Christian Clauss <[email protected]> |
| 91 |
Germain Chazot <[email protected]> |
| 92 |
Harry Moreno <[email protected]> |
| 93 |
kevinbai <[email protected]> |
| 94 |
Martin Paulus <[email protected]> |
| 95 |
Matus Valo <[email protected]> |
| 96 |
Matus Valo <[email protected]> |
| 97 |
maybe-sybr <[email protected]> |
| 98 |
Omer Katz <[email protected]> |
| 99 |
Patrick Cloke <[email protected]> |
| 100 |
qiaocc <[email protected]> |
| 101 |
Thomas Grainger <[email protected]> |
| 102 |
Weiliang Li <[email protected]> |
| 103 |
|
| 104 |
.. note:: |
| 105 |
|
| 106 |
This wall was automatically generated from git history, |
| 107 |
so sadly it doesn't not include the people who help with more important |
| 108 |
things like answering mailing-list questions. |
| 109 |
|
| 110 |
Upgrading from Celery 4.x |
| 111 |
========================= |
| 112 |
|
| 113 |
Step 1: Adjust your command line invocation |
| 114 |
------------------------------------------- |
| 115 |
|
| 116 |
Celery 5.0 introduces a new CLI implementation which isn't completely backwards compatible. |
| 117 |
|
| 118 |
The global options can no longer be positioned after the sub-command. |
| 119 |
Instead, they must be positioned as an option for the `celery` command like so:: |
| 120 |
|
| 121 |
celery --app path.to.app worker |
| 122 |
|
| 123 |
If you were using our :ref:`daemonizing` guide to deploy Celery in production, |
| 124 |
you should revisit it for updates. |
| 125 |
|
| 126 |
Step 2: Update your configuration with the new setting names |
| 127 |
------------------------------------------------------------ |
| 128 |
|
| 129 |
If you haven't already updated your configuration when you migrated to Celery 4.0, |
| 130 |
please do so now. |
| 131 |
|
| 132 |
We elected to extend the deprecation period until 6.0 since |
| 133 |
we did not loudly warn about using these deprecated settings. |
| 134 |
|
| 135 |
Please refer to the :ref:`migration guide <conf-old-settings-map>` for instructions. |
| 136 |
|
| 137 |
Step 3: Read the important notes in this document |
| 138 |
------------------------------------------------- |
| 139 |
|
| 140 |
Make sure you are not affected by any of the important upgrade notes |
| 141 |
mentioned in the :ref:`following section <v500-important>`. |
| 142 |
|
| 143 |
You should mainly verify that any of the breaking changes in the CLI |
| 144 |
do not affect you. Please refer to :ref:`New Command Line Interface <new_command_line_interface>` for details. |
| 145 |
|
| 146 |
Step 4: Migrate your code to Python 3 |
| 147 |
------------------------------------- |
| 148 |
|
| 149 |
Celery 5.0 supports only Python 3. Therefore, you must ensure your code is |
| 150 |
compatible with Python 3. |
| 151 |
|
| 152 |
If you haven't ported your code to Python 3, you must do so before upgrading. |
| 153 |
|
| 154 |
You can use tools like `2to3 <https://docs.python.org/3.8/library/2to3.html>`_ |
| 155 |
and `pyupgrade <https://github.com/asottile/pyupgrade>`_ to assist you with |
| 156 |
this effort. |
| 157 |
|
| 158 |
After the migration is done, run your test suite with Celery 4 to ensure |
| 159 |
nothing has been broken. |
| 160 |
|
| 161 |
Step 5: Upgrade to Celery 5.0 |
| 162 |
----------------------------- |
| 163 |
|
| 164 |
At this point you can upgrade your workers and clients with the new version. |
| 165 |
|
| 166 |
.. _v500-important: |
| 167 |
|
| 168 |
Important Notes |
| 169 |
=============== |
| 170 |
|
| 171 |
Supported Python Versions |
| 172 |
------------------------- |
| 173 |
|
| 174 |
The supported Python Versions are: |
| 175 |
|
| 176 |
- CPython 3.6 |
| 177 |
- CPython 3.7 |
| 178 |
- CPython 3.8 |
| 179 |
- PyPy3.6 7.2 (``pypy3``) |
| 180 |
|
| 181 |
Dropped support for Python 2.7 & 3.5 |
| 182 |
------------------------------------ |
| 183 |
|
| 184 |
Celery now requires Python 3.6 and above. |
| 185 |
|
| 186 |
Python 2.7 has reached EOL in January 2020. |
| 187 |
In order to focus our efforts we have dropped support for Python 2.7 in |
| 188 |
this version. |
| 189 |
|
| 190 |
In addition, Python 3.5 has reached EOL in September 2020. |
| 191 |
Therefore, we are also dropping support for Python 3.5. |
| 192 |
|
| 193 |
If you still require to run Celery using Python 2.7 or Python 3.5 |
| 194 |
you can still use Celery 4.x. |
| 195 |
However we encourage you to upgrade to a supported Python version since |
| 196 |
no further security patches will be applied for Python 2.7 and as mentioned |
| 197 |
Python 3.5 is not supported for practical reasons. |
| 198 |
|
| 199 |
Kombu |
| 200 |
----- |
| 201 |
|
| 202 |
Starting from this release, the minimum required version is Kombu 5.0.0. |
| 203 |
|
| 204 |
Billiard |
| 205 |
-------- |
| 206 |
|
| 207 |
Starting from this release, the minimum required version is Billiard 3.6.3. |
| 208 |
|
| 209 |
Eventlet Workers Pool |
| 210 |
--------------------- |
| 211 |
|
| 212 |
Due to `eventlet/eventlet#526 <https://github.com/eventlet/eventlet/issues/526>`_ |
| 213 |
the minimum required version is eventlet 0.26.1. |
| 214 |
|
| 215 |
Gevent Workers Pool |
| 216 |
------------------- |
| 217 |
|
| 218 |
Starting from this release, the minimum required version is gevent 1.0.0. |
| 219 |
|
| 220 |
Couchbase Result Backend |
| 221 |
------------------------ |
| 222 |
|
| 223 |
The Couchbase result backend now uses the V3 Couchbase SDK. |
| 224 |
|
| 225 |
As a result, we no longer support Couchbase Server 5.x. |
| 226 |
|
| 227 |
Also, starting from this release, the minimum required version |
| 228 |
for the database client is couchbase 3.0.0. |
| 229 |
|
| 230 |
To verify that your Couchbase Server is compatible with the V3 SDK, |
| 231 |
please refer to their `documentation <https://docs.couchbase.com/python-sdk/3.0/project-docs/compatibility.html>`_. |
| 232 |
|
| 233 |
Riak Result Backend |
| 234 |
------------------- |
| 235 |
|
| 236 |
The Riak result backend has been removed as the database is no longer maintained. |
| 237 |
|
| 238 |
The Python client only supports Python 3.6 and below which prevents us from |
| 239 |
supporting it and it is also unmaintained. |
| 240 |
|
| 241 |
If you are still using Riak, refrain from upgrading to Celery 5.0 while you |
| 242 |
migrate your application to a different database. |
| 243 |
|
| 244 |
We apologize for the lack of notice in advance but we feel that the chance |
| 245 |
you'll be affected by this breaking change is minimal which is why we |
| 246 |
did it. |
| 247 |
|
| 248 |
AMQP Result Backend |
| 249 |
------------------- |
| 250 |
|
| 251 |
The AMQP result backend has been removed as it was deprecated in version 4.0. |
| 252 |
|
| 253 |
Removed Deprecated Modules |
| 254 |
-------------------------- |
| 255 |
|
| 256 |
The `celery.utils.encoding` and the `celery.task` modules has been deprecated |
| 257 |
in version 4.0 and therefore are removed in 5.0. |
| 258 |
|
| 259 |
If you were using the `celery.utils.encoding` module before, |
| 260 |
you should import `kombu.utils.encoding` instead. |
| 261 |
|
| 262 |
If you were using the `celery.task` module before, you should import directly |
| 263 |
from the `celery` module instead. |
| 264 |
|
| 265 |
If you were using `from celery.task import Task` you should use |
| 266 |
`from celery import Task` instead. |
| 267 |
|
| 268 |
If you were using the `celery.task` decorator you should use |
| 269 |
`celery.shared_task` instead. |
| 270 |
|
| 271 |
.. _new_command_line_interface: |
| 272 |
|
| 273 |
New Command Line Interface |
| 274 |
-------------------------- |
| 275 |
|
| 276 |
The command line interface has been revamped using Click. |
| 277 |
As a result a few breaking changes has been introduced: |
| 278 |
|
| 279 |
- Postfix global options like `celery worker --app path.to.app` or `celery worker --workdir /path/to/workdir` are no longer supported. |
| 280 |
You should specify them as part of the global options of the main celery command. |
| 281 |
- :program:`celery amqp` and :program:`celery shell` require the `repl` |
| 282 |
sub command to start a shell. You can now also invoke specific commands |
| 283 |
without a shell. Type `celery amqp --help` or `celery shell --help` for details. |
| 284 |
- The API for adding user options has changed. |
| 285 |
Refer to the :ref:`documentation <extending-command-options>` for details. |
| 286 |
|
| 287 |
Click provides shell completion `out of the box <https://click.palletsprojects.com/en/7.x/bashcomplete/>`_. |
| 288 |
This functionality replaces our previous bash completion script and adds |
| 289 |
completion support for the zsh and fish shells. |
| 290 |
|
| 291 |
The bash completion script was exported to `extras/celery.bash <https://github.com/celery/celery/blob/master/extra/bash-completion/celery.bash>`_ |
| 292 |
for the packager's convenience. |
| 293 |
|
| 294 |
Pytest Integration |
| 295 |
------------------ |
| 296 |
|
| 297 |
Starting from Celery 5.0, the pytest plugin is no longer enabled by default. |
| 298 |
|
| 299 |
Please refer to the :ref:`documentation <pytest_plugin>` for instructions. |
| 300 |
|
| 301 |
Ordered Group Results for the Redis Result Backend |
| 302 |
-------------------------------------------------- |
| 303 |
|
| 304 |
Previously group results were not ordered by their invocation order. |
| 305 |
Celery 4.4.7 introduced an opt-in feature to make them ordered. |
| 306 |
|
| 307 |
It is now an opt-out behavior. |
| 308 |
|
| 309 |
If you were previously using the Redis result backend, you might need to |
| 310 |
opt-out of this behavior. |
| 311 |
|
| 312 |
Please refer to the :ref:`documentation <redis-group-result-ordering>` |
| 313 |
for instructions on how to disable this feature. |
| 314 |
|
| 315 |
.. _v500-news: |
| 316 |
|
| 317 |
News |
| 318 |
==== |
| 319 |
|
| 320 |
Retry Policy for the Redis Result Backend |
| 321 |
----------------------------------------- |
| 322 |
|
| 323 |
The retry policy for the Redis result backend is now exposed through |
| 324 |
the result backend transport options. |
| 325 |
|
| 326 |
Please refer to the :ref:`documentation <redis-result-backend-timeout>` for details. |