whatsnew-4.0.rst 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967
  1. .. _whatsnew-4.0:
  2. ===========================================
  3. What's new in Celery 4.0 (0Today8)
  4. ===========================================
  5. :Author: Ask Solem (ask at celeryproject.org)
  6. .. sidebar:: Change history
  7. What's new documents describe the changes in major versions,
  8. we also have a :ref:`changelog` that lists the changes in bugfix
  9. releases (0.0.x), while older series are archived under the :ref:`history`
  10. section.
  11. Celery is a simple, flexible and reliable distributed system to
  12. process vast amounts of messages, while providing operations with
  13. the tools required to maintain such a system.
  14. It's a task queue with focus on real-time processing, while also
  15. supporting task scheduling.
  16. Celery has a large and diverse community of users and contributors,
  17. you should come join us :ref:`on IRC <irc-channel>`
  18. or :ref:`our mailing-list <mailing-list>`.
  19. To read more about Celery you should go read the :ref:`introduction <intro>`.
  20. While this version is backward compatible with previous versions
  21. it's important that you read the following section.
  22. This version is officially supported on CPython 2.7, 3.4 and 3.5.
  23. and also supported on PyPy.
  24. .. _`website`: http://celeryproject.org/
  25. .. topic:: Table of Contents
  26. Make sure you read the important notes before upgrading to this version.
  27. .. contents::
  28. :local:
  29. :depth: 2
  30. Preface
  31. =======
  32. .. _v320-important:
  33. Important Notes
  34. ===============
  35. Dropped support for Python 2.6
  36. ------------------------------
  37. Celery now requires Python 2.7 or later,
  38. and also drops support for Python 3.3 so supported versions are:
  39. - CPython 2.7
  40. - CPython 3.4
  41. - CPython 3.5
  42. - PyPy 4.0 (pypy2)
  43. - PyPy 2.4 (pypy3)
  44. - Jython 2.7.0
  45. JSON is now the default serializer
  46. ----------------------------------
  47. The Task base class no longer automatically register tasks
  48. ----------------------------------------------------------
  49. The metaclass has been removed blah blah
  50. Arguments now verified when calling a task
  51. ------------------------------------------
  52. Redis Events not backward compatible
  53. ------------------------------------
  54. The Redis ``fanout_patterns`` and ``fanout_prefix`` transport
  55. options are now enabled by default, which means that workers
  56. running 4.0 cannot see workers running 3.1 and vice versa.
  57. They should still execute tasks as normally, so this is only
  58. related to monitoring events.
  59. To avoid this situation you can reconfigure the 3.1 workers (and clients)
  60. to enable these settings before you mix them with workers and clients
  61. running 4.x:
  62. .. code-block:: python
  63. BROKER_TRANSPORT_OPTIONS = {
  64. 'fanout_patterns': True,
  65. 'fanout_prefix': True,
  66. }
  67. Lowercase setting names
  68. -----------------------
  69. In the pursuit of beauty all settings have been renamed to be in all
  70. lowercase, in a consistent naming scheme.
  71. This change is fully backwards compatible so you can still use the uppercase
  72. setting names.
  73. The loader will try to detect if your configuration is using the new format,
  74. and act accordingly, but this also means that you are not allowed to mix and
  75. match new and old setting names, that is unless you provide a value for both
  76. alternatives.
  77. The major difference between previous versions, apart from the lower case
  78. names, are the renaming of some prefixes, like ``celerybeat_`` to ``beat_``,
  79. ``celeryd_`` to ``worker_``.
  80. The ``celery_`` prefix has also been removed, and task related settings
  81. from this namespace is now prefixed by ``task_``, worker related settings
  82. with ``worker_``.
  83. Apart from this most of the settings will be the same in lowercase, apart from
  84. a few special ones:
  85. ===================================== ==========================================================
  86. **Setting name** **Replace with**
  87. ===================================== ==========================================================
  88. ``CELERY_MAX_CACHED_RESULTS`` :setting:`result_cache_max`
  89. ``CELERY_MESSAGE_COMPRESSION`` :setting:`result_compression`/:setting:`task_compression`.
  90. ``CELERY_TASK_RESULT_EXPIRES`` :setting:`result_expires`
  91. ``CELERY_RESULT_DBURI`` :setting:`sqlalchemy_dburi`
  92. ``CELERY_RESULT_ENGINE_OPTIONS`` :setting:`sqlalchemy_engine_options`
  93. ``-*-_DB_SHORT_LIVED_SESSIONS`` :setting:`sqlalchemy_short_lived_sessions`
  94. ``CELERY_RESULT_DB_TABLE_NAMES`` :setting:`sqlalchemy_db_names`
  95. ``CELERY_ACKS_LATE`` :setting:`task_acks_late`
  96. ``CELERY_ALWAYS_EAGER`` :setting:`task_always_eager`
  97. ``CELERY_ANNOTATIONS`` :setting:`task_annotations`
  98. ``CELERY_MESSAGE_COMPRESSION`` :setting:`task_compression`
  99. ``CELERY_CREATE_MISSING_QUEUES`` :setting:`task_create_missing_queues`
  100. ``CELERY_DEFAULT_DELIVERY_MODE`` :setting:`task_default_delivery_mode`
  101. ``CELERY_DEFAULT_EXCHANGE`` :setting:`task_default_exchange`
  102. ``CELERY_DEFAULT_EXCHANGE_TYPE`` :setting:`task_default_exchange_type`
  103. ``CELERY_DEFAULT_QUEUE`` :setting:`task_default_queue`
  104. ``CELERY_DEFAULT_RATE_LIMIT`` :setting:`task_default_rate_limit`
  105. ``CELERY_DEFAULT_ROUTING_KEY`` :setting:`task_default_routing_key`
  106. ``-"-_EAGER_PROPAGATES_EXCEPTIONS`` :setting:`task_eager_propagates`
  107. ``CELERY_IGNORE_RESULT`` :setting:`task_ignore_result`
  108. ``CELERY_TASK_PUBLISH_RETRY`` :setting:`task_publish_retry`
  109. ``CELERY_TASK_PUBLISH_RETRY_POLICY`` :setting:`task_publish_retry_policy`
  110. ``CELERY_QUEUES`` :setting:`task_queues`
  111. ``CELERY_ROUTES`` :setting:`task_routes`
  112. ``CELERY_SEND_TASK_ERROR_EMAILS`` :setting:`task_send_error_emails`
  113. ``CELERY_SEND_TASK_SENT_EVENT`` :setting:`task_send_sent_event`
  114. ``CELERY_TASK_SERIALIZER`` :setting:`task_serializer`
  115. ``CELERYD_TASK_SOFT_TIME_LIMIT`` :setting:`task_soft_time_limit`
  116. ``CELERYD_TASK_TIME_LIMIT`` :setting:`task_time_limit`
  117. ``CELERY_TRACK_STARTED`` :setting:`task_track_started`
  118. ``CELERY_DISABLE_RATE_LIMITS`` :setting:`worker_disable_rate_limits`
  119. ``CELERY_ENABLE_REMOTE_CONTROL`` :setting:`worker_enable_remote_control`
  120. ``CELERYD_SEND_EVENTS`` :setting:`worker_send_task_events`
  121. ===================================== ==========================================================
  122. You can see a full table of the changes in :ref:`conf-old-settings-map`.
  123. Django: Autodiscover no longer takes arguments.
  124. -----------------------------------------------
  125. Celery's Django support will instead automatically find your installed apps,
  126. which means app configurations will work.
  127. # e436454d02dcbba4f4410868ad109c54047c2c15
  128. Old command-line programs removed
  129. ---------------------------------
  130. Installing Celery will no longer install the ``celeryd``,
  131. ``celerybeat`` and ``celeryd-multi`` programs.
  132. This was announced with the release of Celery 3.1, but you may still
  133. have scripts pointing to the old names, so make sure you update them
  134. to use the new umbrella command.
  135. +-------------------+--------------+-------------------------------------+
  136. | Program | New Status | Replacement |
  137. +===================+==============+=====================================+
  138. | ``celeryd`` | **REMOVED** | :program:`celery worker` |
  139. +-------------------+--------------+-------------------------------------+
  140. | ``celerybeat`` | **REMOVED** | :program:`celery beat` |
  141. +-------------------+--------------+-------------------------------------+
  142. | ``celeryd-multi`` | **REMOVED** | :program:`celery multi` |
  143. +-------------------+--------------+-------------------------------------+
  144. .. _v320-news:
  145. News
  146. ====
  147. New Task Message Protocol
  148. =========================
  149. # e71652d384b1b5df2a4e6145df9f0efb456bc71c
  150. ``TaskProducer`` replaced by ``app.amqp.create_task_message`` and
  151. ``app.amqp.send_task_message``.
  152. - Worker stores results for internal errors like ``ContentDisallowed``, and
  153. exceptions occurring outside of the task function.
  154. - Worker stores results and sends monitoring events for unknown task names
  155. - Worker calls callbacks/errbacks even when the result is sent by the
  156. parent process (e.g. :exc:`WorkerLostError` when a child process
  157. terminates).
  158. - origin header
  159. - shadow header
  160. - argsrepr header
  161. - Support for very long chains
  162. - parent_id / root_id headers
  163. Prefork: Tasks now log from the child process
  164. =============================================
  165. Logging of task success/failure now happens from the child process
  166. actually executing the task, which means that logging utilities
  167. like Sentry can get full information about tasks that fail, including
  168. variables in the traceback.
  169. Prefork: One logfile per child process
  170. ======================================
  171. Init scrips and :program:`celery multi` now uses the `%I` logfile format
  172. option (e.g. :file:`/var/log/celery/%n%I.log`) to ensure each child
  173. process has a separate log file to avoid race conditions.
  174. You are encouraged to upgrade your init scripts and multi arguments
  175. to do so also.
  176. Ability to configure separate broker urls for read/write
  177. ========================================================
  178. New :setting:`broker_read_url` and :setting:`broker_write_url` settings
  179. have been added so that separate broker urls can be provided
  180. for connections used for consuming/publishing.
  181. In addition to the configuration options, two new methods have been
  182. added the app API:
  183. - ``app.connection_for_read()``
  184. - ``app.connection_for_write()``
  185. These should now be used in place of ``app.connection()`` to specify
  186. the intent of the required connection.
  187. .. note::
  188. Two connection pools are available: ``app.pool`` (read), and
  189. ``app.producer_pool`` (write). The latter does not actually give connections
  190. but full :class:`kombu.Producer` instances.
  191. .. code-block:: python
  192. def publish_some_message(app, producer=None):
  193. with app.producer_or_acquire(producer) as producer:
  194. ...
  195. def consume_messages(app, connection=None):
  196. with app.connection_or_acquire(connection) as connection:
  197. ...
  198. Canvas Refactor
  199. ===============
  200. # BLALBLABLA
  201. d79dcd8e82c5e41f39abd07ffed81ca58052bcd2
  202. 1e9dd26592eb2b93f1cb16deb771cfc65ab79612
  203. e442df61b2ff1fe855881c1e2ff9acc970090f54
  204. 0673da5c09ac22bdd49ba811c470b73a036ee776
  205. - Now unrolls groups within groups into a single group (Issue #1509).
  206. - chunks/map/starmap tasks now routes based on the target task
  207. - chords and chains can now be immutable.
  208. - Fixed bug where serialized signature were not converted back into
  209. signatures (Issue #2078)
  210. Fix contributed by Ross Deane.
  211. - Fixed problem where chains and groups did not work when using JSON
  212. serialization (Issue #2076).
  213. Fix contributed by Ross Deane.
  214. - Creating a chord no longer results in multiple values for keyword
  215. argument 'task_id' (Issue #2225).
  216. Fix contributed by Aneil Mallavarapu
  217. - Fixed issue where the wrong result is returned when a chain
  218. contains a chord as the penultimate task.
  219. Fix contributed by Aneil Mallavarapu
  220. - Special case of ``group(A.s() | group(B.s() | C.s()))`` now works.
  221. - Chain: Fixed bug with incorrect id set when a subtask is also a chain.
  222. - ``group | group`` is now flattened into a single group (Issue #2573).
  223. - Fixed issue where ``group | task`` was not upgrading correctly
  224. to chord (Issue #2922).
  225. Schedule tasks based on sunrise, sunset, dawn and dusk.
  226. =======================================================
  227. See :ref:`beat-solar` for more information.
  228. Contributed by Mark Parncutt.
  229. App can now configure periodic tasks
  230. ====================================
  231. # bc18d0859c1570f5eb59f5a969d1d32c63af764b
  232. # 132d8d94d38f4050db876f56a841d5a5e487b25b
  233. RabbitMQ Priority queue support
  234. ===============================
  235. # 1d4cbbcc921aa34975bde4b503b8df9c2f1816e0
  236. Contributed by Gerald Manipon.
  237. Incompatible: Worker direct queues are no longer using auto-delete.
  238. ===================================================================
  239. Issue #2492.
  240. Prefork: Limits for child process resident memory size.
  241. =======================================================
  242. This version introduces the new :setting:`worker_max_memory_per_child` setting,
  243. which BLA BLA BLA
  244. # 5cae0e754128750a893524dcba4ae030c414de33
  245. Contributed by Dave Smith.
  246. Redis: Result backend optimizations
  247. ===============================================
  248. Pub/sub results
  249. ---------------
  250. Contributed by Yaroslav Zhavoronkov and Ask Solem.
  251. Chord join
  252. ----------
  253. This was an experimental feature introduced in Celery 3.1,
  254. but is now enabled by default.
  255. ?new_join BLABLABLA
  256. Riak Result Backend
  257. ===================
  258. Contributed by Gilles Dartiguelongue, Alman One and NoKriK.
  259. Bla bla
  260. - blah blah
  261. CouchDB Result Backend
  262. ======================
  263. Contributed by Nathan Van Gheem
  264. New Cassandra Backend
  265. =====================
  266. The new Cassandra backend utilizes the python-driver library.
  267. Old backend is deprecated and everyone using cassandra is required to upgrade
  268. to be using the new driver.
  269. # XXX What changed?
  270. Elasticsearch Result Backend
  271. ============================
  272. Contributed by Ahmet Demir.
  273. Filesystem Result Backend
  274. =========================
  275. Contributed by Môshe van der Sterre.
  276. Event Batching
  277. ==============
  278. Events are now buffered in the worker and sent as a list, and
  279. events are sent as transient messages by default so that they are not written
  280. to disk by RabbitMQ.
  281. 03399b4d7c26fb593e61acf34f111b66b340ba4e
  282. Task.replace
  283. ============
  284. Task.replace changed, removes Task.replace_in_chord.
  285. The two methods had almost the same functionality, but the old Task.replace
  286. would force the new task to inherit the callbacks/errbacks of the existing
  287. task.
  288. If you replace a node in a tree, then you would not expect the new node to
  289. inherit the children of the old node, so this seems like unexpected
  290. behavior.
  291. So self.replace(sig) now works for any task, in addition sig can now
  292. be a group.
  293. Groups are automatically converted to a chord, where the callback
  294. will "accumulate" the results of the group tasks.
  295. A new builtin task (`celery.accumulate` was added for this purpose)
  296. Closes #817
  297. Optimized Beat implementation
  298. =============================
  299. heapq
  300. 20340d79b55137643d5ac0df063614075385daaa
  301. Contributed by Ask Solem and Alexander Koshelev.
  302. Task Autoretry Decorator
  303. ========================
  304. 75246714dd11e6c463b9dc67f4311690643bff24
  305. Contributed by Dmitry Malinovsky.
  306. Async Result API
  307. ================
  308. eventlet/gevent drainers, promises, BLA BLA
  309. Closed issue #2529.
  310. :setting:`task_routes` can now contain glob patterns and regexes.
  311. =================================================================
  312. See examples in :setting:`task_routes` and :ref:`routing-automatic`.
  313. In Other News
  314. -------------
  315. - **Requirements**:
  316. - Now depends on :ref:`Kombu 3.1 <kombu:version-3.1.0>`.
  317. - Now depends on :mod:`billiard` version 3.4.
  318. - No longer depends on ``anyjson`` :sadface:
  319. - **Tasks**: The "anon-exchange" is now used for simple name-name direct routing.
  320. This increases performance as it completely bypasses the routing table,
  321. in addition it also improves reliability for the Redis broker transport.
  322. - **Eventlet/Gevent**: Fixed race condition leading to "simultaneous read"
  323. errors (Issue #2812).
  324. - **Programs**: ``%n`` format for :program:`celery multi` is now synonym with
  325. ``%N`` to be consistent with :program:`celery worker`.
  326. - **Programs**: celery inspect/control now supports ``--json`` argument to
  327. give output in json format.
  328. - **Programs**: :program:`celery inspect registered` now ignores built-in
  329. tasks.
  330. - **Programs**: New :program:`celery logtool`: Utility for filtering and parsing
  331. celery worker logfiles
  332. - **Redis Transport**: The Redis transport now supports the
  333. :setting:`broker_use_ssl` option.
  334. - **Worker**: Worker now only starts the remote control command consumer if the
  335. broker transport used actually supports them.
  336. - **Worker**: Gossip now sets ``x-message-ttl`` for event queue to heartbeat_interval s.
  337. (Issue #2005).
  338. - **Worker**: Now preserves exit code (Issue #2024).
  339. - **Worker**: Loglevel for unrecoverable errors changed from ``error`` to
  340. ``critical``.
  341. - **Worker**: Improved rate limiting accuracy.
  342. - **Worker**: Account for missing timezone information in task expires field.
  343. Fix contributed by Albert Wang.
  344. - **Worker**: The worker no longer has a ``Queues`` bootsteps, as it is now
  345. superfluous.
  346. - **Tasks**: New :setting:`task_reject_on_worker_lost` setting, and
  347. :attr:`~@Task.reject_on_worker_lost` task attribute decides what happens
  348. when the child worker process executing a late ack task is terminated.
  349. Contributed by Michael Permana.
  350. - **Worker**: Improvements and fixes for LimitedSet
  351. Getting rid of leaking memory + adding minlen size of the set
  352. minlen is minimal residual size of set after operating for long.
  353. Minlen items are kept, even if they should be expired by time, until
  354. we get newer items.
  355. Problems with older and even more old code:
  356. 1)
  357. Heap would tend to grow in some scenarios
  358. (like adding an item multiple times).
  359. 2) Adding many items fast would not clean them soon enough (if ever).
  360. 3) When talking to other workers, revoked._data was sent, but
  361. it was processed on the other side as iterable.
  362. That means giving those keys new (current)
  363. timestamp. By doing this workers could recycle
  364. items forever. Combined with 1) and 2), this means that in
  365. large set of workers, you are getting out of memory soon.
  366. All those problems should be fixed now,
  367. also some new unittests are added.
  368. This should fix issues #3095, #3086.
  369. Contributed by David Pravec.
  370. - **App**: New signals for app configuration/finalization:
  371. - :data:`app.on_configure <@on_configure>`
  372. - :data:`app.on_after_configure <@on_after_configure>`
  373. - :data:`app.on_after_finalize <@on_after_finalize>`
  374. - **Task**: New task signals for rejected task messages:
  375. - :data:`celery.signals.task_rejected`.
  376. - :data:`celery.signals.task_unknown`.
  377. - **Events**: Event messages now uses the RabbitMQ ``x-message-ttl`` option
  378. to ensure older event messages are discarded.
  379. The default is 5 seconds, but can be changed using the
  380. :setting:`event_queue_ttl` setting.
  381. - **Events**: Event monitors now sets the :setting:`event_queue_expires`
  382. setting by default.
  383. The queues will now expire after 60 seconds after the monitor stops
  384. consuming from it.
  385. - **Canvas**: ``chunks``/``map``/``starmap`` are now routed based on the target task.
  386. - **Canvas**: ``Signature.link`` now works when argument is scalar (not a list)
  387. (Issue #2019).
  388. - **App**: The application can now change how task names are generated using
  389. the :meth:`~@gen_task_name` method.
  390. Contributed by Dmitry Malinovsky.
  391. - **App**: App has new ``app.current_worker_task`` property that
  392. returns the task that is currently being worked on (or :const:`None`).
  393. (Issue #2100).
  394. - **Tasks**: ``Task.subtask`` renamed to ``Task.signature`` with alias.
  395. - **Tasks**: ``Task.subtask_from_request`` renamed to
  396. ``Task.signature_from_request`` with alias.
  397. - **Tasks**: The ``delivery_mode`` attribute for :class:`kombu.Queue` is now
  398. respected (Issue #1953).
  399. - **Tasks**: Routes in :setting:`task-routes` can now specify a
  400. :class:`~kombu.Queue` instance directly.
  401. Example:
  402. .. code-block:: python
  403. task_routes = {'proj.tasks.add': {'queue': Queue('add')}}
  404. - **Tasks**: ``AsyncResult`` now raises :exc:`ValueError` if task_id is None.
  405. (Issue #1996).
  406. - **Tasks**: ``result.get()`` now supports an ``on_message`` argument to set a
  407. callback to be called for every message received.
  408. - **Tasks**: New abstract classes added:
  409. - :class:`~celery.utils.abstract.CallableTask`
  410. Looks like a task.
  411. - :class:`~celery.utils.abstract.CallableSignature`
  412. Looks like a task signature.
  413. - **Programs**: :program:`celery multi` now passes through `%i` and `%I` log
  414. file formats.
  415. - **Programs**: ``%p`` can now be used to expand to the full worker nodename
  416. in logfile/pidfile arguments.
  417. - **Programs**: A new command line option :option:``--executable`` is now
  418. available for daemonizing programs.
  419. Contributed by Bert Vanderbauwhede.
  420. - **Programs**: :program:`celery worker` supports new
  421. :option:`--prefetch-multiplier` option.
  422. Contributed by Mickaël Penhard.
  423. - **Deployment**: Generic init scripts now support
  424. :envvar:`CELERY_SU`` and :envvar:`CELERYD_SU_ARGS` environment variables
  425. to set the path and arguments for :man:`su(1)`.
  426. - **Prefork**: Prefork pool now uses ``poll`` instead of ``select`` where
  427. available (Issue #2373).
  428. - **Eventlet**: Now returns pool size in :program:`celery inspect stats`
  429. command.
  430. Contributed by Alexander Oblovatniy.
  431. - **Tasks**: New :setting:`email_charset` setting allows for changing
  432. the charset used for outgoing error emails.
  433. Contributed by Vladimir Gorbunov.
  434. - **Worker**: Now respects :setting:`broker_connection_retry` setting.
  435. Fix contributed by Nat Williams.
  436. - **Worker**: Autoscale did not always update keepalive when scaling down.
  437. Fix contributed by Philip Garnero.
  438. - **General**: Dates are now always timezone aware even if
  439. :setting:`enable_utc` is disabled (Issue #943).
  440. Fix contributed by Omer Katz.
  441. - **Result Backends**: The redis result backend now has a default socket
  442. timeout of 5 seconds.
  443. The default can be changed using the new :setting:`redis_socket_timeout`
  444. setting.
  445. Contributed by Raghuram Srinivasan.
  446. - **Result Backends**: RPC Backend result queues are now auto delete by
  447. default (Issue #2001).
  448. - **Result Backends**: MongoDB now supports setting the
  449. :setting:`result_serialzier` setting to ``bson`` to use the MongoDB
  450. libraries own serializer.
  451. Contributed by Davide Quarta.
  452. - **Result Backends**: SQLAlchemy result backend now ignores all result
  453. engine options when using NullPool (Issue #1930).
  454. - **Result Backends**: MongoDB URI handling has been improved to use
  455. database name, user and password from the URI if provided.
  456. Contributed by Samuel Jaillet.
  457. - **Result Backends**: Fix problem with rpc/amqp backends where exception
  458. was not deserialized properly with the json serializer (Issue #2518).
  459. Fix contributed by Allard Hoeve.
  460. - **Result Backends**: Database backend now sets max char size to 155 to deal
  461. with brain damaged MySQL unicode implementation (Issue #1748).
  462. - **General**: All Celery exceptions/warnings now inherit from common
  463. :class:`~celery.exceptions.CeleryException`/:class:`~celery.exceptions.CeleryWarning`.
  464. (Issue #2643).
  465. - **Tasks**: Task retry now also throws in eager mode.
  466. Fix contributed by Feanil Patel.
  467. - **Tasks**: Task error email charset now set to ``utf-8`` by default
  468. (Issue #2737).
  469. - Apps can now define how tasks are named (:meth:`@gen_task_name`).
  470. Contributed by Dmitry Malinovsky
  471. - Module ``celery.worker.job`` renamed to :mod:`celery.worker.request`.
  472. - Beat: ``Scheduler.Publisher``/``.publisher`` renamed to
  473. ``.Producer``/``.producer``.
  474. Incompatible changes
  475. ====================
  476. - Prefork: Calling ``result.get()`` or joining any result from within a task
  477. now raises :exc:`RuntimeError`.
  478. In previous versions this would emit a warning.
  479. - :mod:`celery.worker.consumer` is now a package, not a module.
  480. - Result: The task_name argument/attribute of :class:`@AsyncResult` was
  481. removed.
  482. This was historically a field used for :mod:`pickle` compatibility,
  483. but is no longer needed.
  484. - Backends: Arguments named ``status`` renamed to ``state``.
  485. - Backends: ``backend.get_status()`` renamed to ``backend.get_state()``.
  486. Unscheduled Removals
  487. ====================
  488. - The experimental :mod:`celery.contrib.methods` feature has been removed,
  489. as there were far many bugs in the implementation to be useful.
  490. - The CentOS init scripts have been removed.
  491. These did not really add any features over the generic init scripts,
  492. so you are encouraged to use them instead, or something like
  493. ``supervisord``.
  494. .. _v320-removals:
  495. Scheduled Removals
  496. ==================
  497. Modules
  498. -------
  499. - Module ``celery.worker.job`` has been renamed to :mod:`celery.worker.request`.
  500. This was an internal module so should not have any effect.
  501. It is now part of the public API so should not change again.
  502. - Module ``celery.task.trace`` has been renamed to ``celery.app.trace``
  503. as the ``celery.task`` package is being phased out. The compat module
  504. will be removed in version 4.0 so please change any import from::
  505. from celery.task.trace import …
  506. to::
  507. from celery.app.trace import …
  508. - Old compatibility aliases in the :mod:`celery.loaders` module
  509. has been removed.
  510. - Removed ``celery.loaders.current_loader()``, use: ``current_app.loader``
  511. - Removed ``celery.loaders.load_settings()``, use: ``current_app.conf``
  512. Result
  513. ------
  514. - ``AsyncResult.serializable()`` and ``celery.result.from_serializable``
  515. has been removed:
  516. Use instead:
  517. .. code-block:: pycon
  518. >>> tup = result.as_tuple()
  519. >>> from celery.result import result_from_tuple
  520. >>> result = result_from_tuple(tup)
  521. - Removed ``BaseAsyncResult``, use ``AsyncResult`` for instance checks
  522. instead.
  523. - Removed ``TaskSetResult``, use ``GroupResult`` instead.
  524. - ``TaskSetResult.total`` -> ``len(GroupResult)``
  525. - ``TaskSetResult.taskset_id`` -> ``GroupResult.id``
  526. - Removed ``ResultSet.subtasks``, use ``ResultSet.results`` instead.
  527. TaskSet
  528. -------
  529. TaskSet has been renamed to group and TaskSet will be removed in version 4.0.
  530. Old::
  531. >>> from celery.task import TaskSet
  532. >>> TaskSet(add.subtask((i, i)) for i in xrange(10)).apply_async()
  533. New::
  534. >>> from celery import group
  535. >>> group(add.s(i, i) for i in xrange(10))()
  536. Events
  537. ------
  538. - Removals for class :class:`celery.events.state.Worker`:
  539. - ``Worker._defaults`` attribute.
  540. Use ``{k: getattr(worker, k) for k in worker._fields}``.
  541. - ``Worker.update_heartbeat``
  542. Use ``Worker.event(None, timestamp, received)``
  543. - ``Worker.on_online``
  544. Use ``Worker.event('online', timestamp, received, fields)``
  545. - ``Worker.on_offline``
  546. Use ``Worker.event('offline', timestamp, received, fields)``
  547. - ``Worker.on_heartbeat``
  548. Use ``Worker.event('heartbeat', timestamp, received, fields)``
  549. - Removals for class :class:`celery.events.state.Task`:
  550. - ``Task._defaults`` attribute.
  551. Use ``{k: getattr(task, k) for k in task._fields}``.
  552. - ``Task.on_sent``
  553. Use ``Worker.event('sent', timestamp, received, fields)``
  554. - ``Task.on_received``
  555. Use ``Task.event('received', timestamp, received, fields)``
  556. - ``Task.on_started``
  557. Use ``Task.event('started', timestamp, received, fields)``
  558. - ``Task.on_failed``
  559. Use ``Task.event('failed', timestamp, received, fields)``
  560. - ``Task.on_retried``
  561. Use ``Task.event('retried', timestamp, received, fields)``
  562. - ``Task.on_succeeded``
  563. Use ``Task.event('succeeded', timestamp, received, fields)``
  564. - ``Task.on_revoked``
  565. Use ``Task.event('revoked', timestamp, received, fields)``
  566. - ``Task.on_unknown_event``
  567. Use ``Task.event(short_type, timestamp, received, fields)``
  568. - ``Task.update``
  569. Use ``Task.event(short_type, timestamp, received, fields)``
  570. - ``Task.merge``
  571. Contact us if you need this.
  572. Magic keyword arguments
  573. -----------------------
  574. Support for the very old magic keyword arguments accepted by tasks has finally
  575. been in 4.0.
  576. If you are still using these you have to rewrite any task still
  577. using the old ``celery.decorators`` module and depending
  578. on keyword arguments being passed to the task,
  579. for example::
  580. from celery.decorators import task
  581. @task()
  582. def add(x, y, task_id=None):
  583. print('My task id is %r' % (task_id,))
  584. should be rewritten into::
  585. from celery import task
  586. @task(bind=True)
  587. def add(self, x, y):
  588. print('My task id is {0.request.id}'.format(self))
  589. Settings
  590. --------
  591. The following settings have been removed, and is no longer supported:
  592. Logging Settings
  593. ~~~~~~~~~~~~~~~~
  594. ===================================== =====================================
  595. **Setting name** **Replace with**
  596. ===================================== =====================================
  597. ``CELERYD_LOG_LEVEL`` :option:`--loglevel`
  598. ``CELERYD_LOG_FILE`` :option:`--logfile``
  599. ``CELERYBEAT_LOG_LEVEL`` :option:`--loglevel`
  600. ``CELERYBEAT_LOG_FILE`` :option:`--loglevel``
  601. ``CELERYMON_LOG_LEVEL`` celerymon is deprecated, use flower.
  602. ``CELERYMON_LOG_FILE`` celerymon is deprecated, use flower.
  603. ``CELERYMON_LOG_FORMAT`` celerymon is deprecated, use flower.
  604. ===================================== =====================================
  605. Task Settings
  606. ~~~~~~~~~~~~~~
  607. ===================================== =====================================
  608. **Setting name** **Replace with**
  609. ===================================== =====================================
  610. ``CELERY_CHORD_PROPAGATES`` N/a
  611. ===================================== =====================================
  612. .. _v320-deprecations:
  613. Deprecations
  614. ============
  615. See the :ref:`deprecation-timeline`.
  616. .. _v320-fixes:
  617. Fixes
  618. =====