whatsnew-3.0.rst 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031
  1. .. _whatsnew-3.0:
  2. ===========================================
  3. What's new in Celery 3.0 (Chiastic Slide)
  4. ===========================================
  5. Celery is a simple, flexible and reliable distributed system to
  6. process vast amounts of messages, while providing operations with
  7. the tools required to maintain such a system.
  8. It's a task queue with focus on real-time processing, while also
  9. supporting task scheduling.
  10. Celery has a large and diverse community of users and contributors,
  11. you should come join us :ref:`on IRC <irc-channel>`
  12. or :ref:`our mailing-list <mailing-list>`.
  13. To read more about Celery you should go read the :ref:`introduction <intro>`.
  14. While this version is backward compatible with previous versions
  15. it's important that you read the following section.
  16. If you use Celery in combination with Django you must also
  17. read the `django-celery changelog`_ and upgrade to `django-celery 3.0`_.
  18. This version is officially supported on CPython 2.5, 2.6, 2.7, 3.2 and 3.3,
  19. as well as PyPy and Jython.
  20. Highlights
  21. ==========
  22. .. topic:: Overview
  23. - A new and improved API, that is both simpler and more powerful.
  24. Everyone must read the new :ref:`first-steps` tutorial,
  25. and the new :ref:`next-steps` tutorial. Oh, and
  26. why not reread the user guide while you're at it :)
  27. There are no current plans to deprecate the old API,
  28. so you don't have to be in a hurry to port your applications.
  29. - The worker is now thread-less, giving great performance improvements.
  30. - The new "Canvas" makes it easy to define complex workflows.
  31. Ever wanted to chain tasks together? This is possible, but
  32. not just that, now you can even chain together groups and chords,
  33. or even combine multiple chains.
  34. Read more in the :ref:`Canvas <guide-canvas>` user guide.
  35. - All of Celery's command-line programs are now available from a single
  36. :program:`celery` umbrella command.
  37. - This is the last version to support Python 2.5.
  38. Starting with Celery 3.1, Python 2.6 or later is required.
  39. - Support for the new :pypi:`librabbitmq` C client.
  40. Celery will automatically use the :pypi:`librabbitmq` module
  41. if installed, which is a very fast and memory-optimized
  42. replacement for the py-amqp module.
  43. - Redis support is more reliable with improved ack emulation.
  44. - Celery now always uses UTC
  45. - Over 600 commits, 30k additions/36k deletions.
  46. In comparison 1.0➝ 2.0 had 18k additions/8k deletions.
  47. .. _`website`: http://celeryproject.org/
  48. .. _`django-celery changelog`:
  49. https://github.com/celery/django-celery/tree/master/Changelog
  50. .. _`django-celery 3.0`: http://pypi.python.org/pypi/django-celery/
  51. .. contents::
  52. :local:
  53. :depth: 2
  54. .. _v300-important:
  55. Important Notes
  56. ===============
  57. Broadcast exchanges renamed
  58. ---------------------------
  59. The workers remote control command exchanges has been renamed
  60. (a new pidbox name), this is because the ``auto_delete`` flag on the exchanges
  61. has been removed, and that makes it incompatible with earlier versions.
  62. You can manually delete the old exchanges if you want,
  63. using the :program:`celery amqp` command (previously called ``camqadm``):
  64. .. code-block:: console
  65. $ celery amqp exchange.delete celeryd.pidbox
  66. $ celery amqp exchange.delete reply.celeryd.pidbox
  67. Eventloop
  68. ---------
  69. The worker is now running *without threads* when used with RabbitMQ (AMQP),
  70. or Redis as a broker, resulting in:
  71. - Much better overall performance.
  72. - Fixes several edge case race conditions.
  73. - Sub-millisecond timer precision.
  74. - Faster shutdown times.
  75. The transports supported are: ``py-amqp`` ``librabbitmq``, ``redis``,
  76. and ``amqplib``.
  77. Hopefully this can be extended to include additional broker transports
  78. in the future.
  79. For increased reliability the :setting:`CELERY_FORCE_EXECV` setting is enabled
  80. by default if the eventloop is not used.
  81. New ``celery`` umbrella command
  82. -------------------------------
  83. All Celery's command-line programs are now available from a single
  84. :program:`celery` umbrella command.
  85. You can see a list of subcommands and options by running:
  86. .. code-block:: console
  87. $ celery help
  88. Commands include:
  89. - ``celery worker`` (previously ``celeryd``).
  90. - ``celery beat`` (previously ``celerybeat``).
  91. - ``celery amqp`` (previously ``camqadm``).
  92. The old programs are still available (``celeryd``, ``celerybeat``, etc),
  93. but you are discouraged from using them.
  94. Now depends on :pypi:`billiard`.
  95. --------------------------------
  96. Billiard is a fork of the multiprocessing containing
  97. the no-execv patch by sbt (http://bugs.python.org/issue8713),
  98. and also contains the pool improvements previously located in Celery.
  99. This fork was necessary as changes to the C extension code was required
  100. for the no-execv patch to work.
  101. - Issue #625
  102. - Issue #627
  103. - Issue #640
  104. - `django-celery #122 <https://github.com/celery/django-celery/issues/122`
  105. - `django-celery #124 <https://github.com/celery/django-celery/issues/122`
  106. :mod:`celery.app.task` no longer a package
  107. ------------------------------------------
  108. The :mod:`celery.app.task` module is now a module instead of a package.
  109. The setup.py install script will try to remove the old package,
  110. but if that doesn't work for some reason you have to remove
  111. it manually. This command helps:
  112. .. code-block:: console
  113. $ rm -r $(dirname $(python -c 'import celery;print(celery.__file__)'))/app/task/
  114. If you experience an error like ``ImportError: cannot import name _unpickle_task``,
  115. you just have to remove the old package and everything is fine.
  116. Last version to support Python 2.5
  117. ----------------------------------
  118. The 3.0 series will be last version to support Python 2.5,
  119. and starting from 3.1 Python 2.6 and later will be required.
  120. With several other distributions taking the step to discontinue
  121. Python 2.5 support, we feel that it is time too.
  122. Python 2.6 should be widely available at this point, and we urge
  123. you to upgrade, but if that is not possible you still have the option
  124. to continue using the Celery 3.0, and important bug fixes
  125. introduced in Celery 3.1 will be back-ported to Celery 3.0 upon request.
  126. UTC timezone is now used
  127. ------------------------
  128. This means that ETA/countdown in messages are not compatible with Celery
  129. versions prior to 2.5.
  130. You can disable UTC and revert back to old local time by setting
  131. the :setting:`CELERY_ENABLE_UTC` setting.
  132. Redis: Ack emulation improvements
  133. ---------------------------------
  134. Reducing the possibility of data loss.
  135. Acks are now implemented by storing a copy of the message when the message
  136. is consumed. The copy is not removed until the consumer acknowledges
  137. or rejects it.
  138. This means that unacknowledged messages will be redelivered either
  139. when the connection is closed, or when the visibility timeout is exceeded.
  140. - Visibility timeout
  141. This is a timeout for acks, so that if the consumer
  142. does not ack the message within this time limit, the message
  143. is redelivered to another consumer.
  144. The timeout is set to one hour by default, but
  145. can be changed by configuring a transport option::
  146. BROKER_TRANSPORT_OPTIONS = {'visibility_timeout': 18000} # 5 hours
  147. .. note::
  148. Messages that have not been acked will be redelivered
  149. if the visibility timeout is exceeded, for Celery users
  150. this means that ETA/countdown tasks that are scheduled to execute
  151. with a time that exceeds the visibility timeout will be executed
  152. twice (or more). If you plan on using long ETA/countdowns you
  153. should tweak the visibility timeout accordingly.
  154. Setting a long timeout means that it will take a long time
  155. for messages to be redelivered in the event of a power failure,
  156. but if so happens you could temporarily set the visibility timeout lower
  157. to flush out messages when you start up the systems again.
  158. .. _v300-news:
  159. News
  160. ====
  161. Chaining Tasks
  162. --------------
  163. Tasks can now have callbacks and errbacks, and dependencies are recorded
  164. - The task message format have been updated with two new extension keys
  165. Both keys can be empty/undefined or a list of subtasks.
  166. - ``callbacks``
  167. Applied if the task exits successfully, with the result
  168. of the task as an argument.
  169. - ``errbacks``
  170. Applied if an error occurred while executing the task,
  171. with the uuid of the task as an argument. Since it may not be possible
  172. to serialize the exception instance, it passes the uuid of the task
  173. instead. The uuid can then be used to retrieve the exception and
  174. traceback of the task from the result backend.
  175. - ``link`` and ``link_error`` keyword arguments has been added
  176. to ``apply_async``.
  177. These add callbacks and errbacks to the task, and
  178. you can read more about them at :ref:`calling-links`.
  179. - We now track what subtasks a task sends, and some result backends
  180. supports retrieving this information.
  181. - task.request.children
  182. Contains the result instances of the subtasks
  183. the currently executing task has applied.
  184. - AsyncResult.children
  185. Returns the tasks dependencies, as a list of
  186. ``AsyncResult``/``ResultSet`` instances.
  187. - AsyncResult.iterdeps
  188. Recursively iterates over the tasks dependencies,
  189. yielding `(parent, node)` tuples.
  190. Raises IncompleteStream if any of the dependencies
  191. has not returned yet.
  192. - AsyncResult.graph
  193. A ``DependencyGraph`` of the tasks dependencies.
  194. This can also be used to convert to dot format:
  195. .. code-block:: python
  196. with open('graph.dot') as fh:
  197. result.graph.to_dot(fh)
  198. which can than be used to produce an image:
  199. .. code-block:: console
  200. $ dot -Tpng graph.dot -o graph.png
  201. - A new special subtask called ``chain`` is also included:
  202. .. code-block:: pycon
  203. >>> from celery import chain
  204. # (2 + 2) * 8 / 2
  205. >>> res = chain(add.subtask((2, 2)),
  206. mul.subtask((8,)),
  207. div.subtask((2,))).apply_async()
  208. >>> res.get() == 16
  209. >>> res.parent.get() == 32
  210. >>> res.parent.parent.get() == 4
  211. - Adds :meth:`AsyncResult.get_leaf`
  212. Waits and returns the result of the leaf subtask.
  213. That is the last node found when traversing the graph,
  214. but this means that the graph can be 1-dimensional only (in effect
  215. a list).
  216. - Adds ``subtask.link(subtask)`` + ``subtask.link_error(subtask)``
  217. Shortcut to ``s.options.setdefault('link', []).append(subtask)``
  218. - Adds ``subtask.flatten_links()``
  219. Returns a flattened list of all dependencies (recursively)
  220. Redis: Priority support.
  221. ------------------------
  222. The message's ``priority`` field is now respected by the Redis
  223. transport by having multiple lists for each named queue.
  224. The queues are then consumed by in order of priority.
  225. The priority field is a number in the range of 0 - 9, where
  226. 0 is the default and highest priority.
  227. The priority range is collapsed into four steps by default, since it is
  228. unlikely that nine steps will yield more benefit than using four steps.
  229. The number of steps can be configured by setting the ``priority_steps``
  230. transport option, which must be a list of numbers in **sorted order**:
  231. .. code-block:: pycon
  232. >>> BROKER_TRANSPORT_OPTIONS = {
  233. ... 'priority_steps': [0, 2, 4, 6, 8, 9],
  234. ... }
  235. Priorities implemented in this way is not as reliable as
  236. priorities on the server side, which is why
  237. the feature is nicknamed "quasi-priorities";
  238. **Using routing is still the suggested way of ensuring
  239. quality of service**, as client implemented priorities
  240. fall short in a number of ways, e.g. if the worker
  241. is busy with long running tasks, has prefetched many messages,
  242. or the queues are congested.
  243. Still, it is possible that using priorities in combination
  244. with routing can be more beneficial than using routing
  245. or priorities alone. Experimentation and monitoring
  246. should be used to prove this.
  247. Contributed by Germán M. Bravo.
  248. Redis: Now cycles queues so that consuming is fair.
  249. ---------------------------------------------------
  250. This ensures that a very busy queue won't block messages
  251. from other queues, and ensures that all queues have
  252. an equal chance of being consumed from.
  253. This used to be the case before, but the behavior was
  254. accidentally changed while switching to using blocking pop.
  255. `group`/`chord`/`chain` are now subtasks
  256. ----------------------------------------
  257. - group is no longer an alias to TaskSet, but new alltogether,
  258. since it was very difficult to migrate the TaskSet class to become
  259. a subtask.
  260. - A new shortcut has been added to tasks:
  261. .. code-block:: pycon
  262. >>> task.s(arg1, arg2, kw=1)
  263. as a shortcut to:
  264. .. code-block:: pycon
  265. >>> task.subtask((arg1, arg2), {'kw': 1})
  266. - Tasks can be chained by using the ``|`` operator:
  267. .. code-block:: pycon
  268. >>> (add.s(2, 2), pow.s(2)).apply_async()
  269. - Subtasks can be "evaluated" using the ``~`` operator:
  270. .. code-block:: pycon
  271. >>> ~add.s(2, 2)
  272. 4
  273. >>> ~(add.s(2, 2) | pow.s(2))
  274. is the same as:
  275. .. code-block:: pycon
  276. >>> chain(add.s(2, 2), pow.s(2)).apply_async().get()
  277. - A new subtask_type key has been added to the subtask dicts
  278. This can be the string "chord", "group", "chain", "chunks",
  279. "xmap", or "xstarmap".
  280. - maybe_subtask now uses subtask_type to reconstruct
  281. the object, to be used when using non-pickle serializers.
  282. - The logic for these operations have been moved to dedicated
  283. tasks celery.chord, celery.chain and celery.group.
  284. - subtask no longer inherits from AttributeDict.
  285. It's now a pure dict subclass with properties for attribute
  286. access to the relevant keys.
  287. - The repr's now outputs how the sequence would like imperatively:
  288. .. code-block:: pycon
  289. >>> from celery import chord
  290. >>> (chord([add.s(i, i) for i in xrange(10)], xsum.s())
  291. | pow.s(2))
  292. tasks.xsum([tasks.add(0, 0),
  293. tasks.add(1, 1),
  294. tasks.add(2, 2),
  295. tasks.add(3, 3),
  296. tasks.add(4, 4),
  297. tasks.add(5, 5),
  298. tasks.add(6, 6),
  299. tasks.add(7, 7),
  300. tasks.add(8, 8),
  301. tasks.add(9, 9)]) | tasks.pow(2)
  302. New remote control commands
  303. ---------------------------
  304. These commands were previously experimental, but they have proven
  305. stable and is now documented as part of the offical API.
  306. - :control:`add_consumer`/:control:`cancel_consumer`
  307. Tells workers to consume from a new queue, or cancel consuming from a
  308. queue. This command has also been changed so that the worker remembers
  309. the queues added, so that the change will persist even if
  310. the connection is re-connected.
  311. These commands are available programmatically as
  312. :meth:`@control.add_consumer` / :meth:`@control.cancel_consumer`:
  313. .. code-block:: pycon
  314. >>> celery.control.add_consumer(queue_name,
  315. ... destination=['w1.example.com'])
  316. >>> celery.control.cancel_consumer(queue_name,
  317. ... destination=['w1.example.com'])
  318. or using the :program:`celery control` command:
  319. .. code-block:: console
  320. $ celery control -d w1.example.com add_consumer queue
  321. $ celery control -d w1.example.com cancel_consumer queue
  322. .. note::
  323. Remember that a control command without *destination* will be
  324. sent to **all workers**.
  325. - :control:`autoscale`
  326. Tells workers with `--autoscale` enabled to change autoscale
  327. max/min concurrency settings.
  328. This command is available programmatically as :meth:`@control.autoscale`:
  329. .. code-block:: pycon
  330. >>> celery.control.autoscale(max=10, min=5,
  331. ... destination=['w1.example.com'])
  332. or using the :program:`celery control` command:
  333. .. code-block:: console
  334. $ celery control -d w1.example.com autoscale 10 5
  335. - :control:`pool_grow`/:control:`pool_shrink`
  336. Tells workers to add or remove pool processes.
  337. These commands are available programmatically as
  338. :meth:`@control.pool_grow` / :meth:`@control.pool_shrink`:
  339. .. code-block:: pycon
  340. >>> celery.control.pool_grow(2, destination=['w1.example.com'])
  341. >>> celery.contorl.pool_shrink(2, destination=['w1.example.com'])
  342. or using the :program:`celery control` command:
  343. .. code-block:: console
  344. $ celery control -d w1.example.com pool_grow 2
  345. $ celery control -d w1.example.com pool_shrink 2
  346. - :program:`celery control` now supports :control:`rate_limit` and
  347. :control:`time_limit` commands.
  348. See ``celery control --help`` for details.
  349. Crontab now supports Day of Month, and Month of Year arguments
  350. --------------------------------------------------------------
  351. See the updated list of examples at :ref:`beat-crontab`.
  352. Immutable subtasks
  353. ------------------
  354. ``subtask``'s can now be immutable, which means that the arguments
  355. will not be modified when calling callbacks:
  356. .. code-block:: pycon
  357. >>> chain(add.s(2, 2), clear_static_electricity.si())
  358. means it will not receive the argument of the parent task,
  359. and ``.si()`` is a shortcut to:
  360. .. code-block:: pycon
  361. >>> clear_static_electricity.subtask(immutable=True)
  362. Logging Improvements
  363. --------------------
  364. Logging support now conforms better with best practices.
  365. - Classes used by the worker no longer uses app.get_default_logger, but uses
  366. `celery.utils.log.get_logger` which simply gets the logger not setting the
  367. level, and adds a NullHandler.
  368. - Loggers are no longer passed around, instead every module using logging
  369. defines a module global logger that is used throughout.
  370. - All loggers inherit from a common logger called "celery".
  371. - Before task.get_logger would setup a new logger for every task,
  372. and even set the loglevel. This is no longer the case.
  373. - Instead all task loggers now inherit from a common "celery.task" logger
  374. that is set up when programs call `setup_logging_subsystem`.
  375. - Instead of using LoggerAdapter to augment the formatter with
  376. the task_id and task_name field, the task base logger now use
  377. a special formatter adding these values at runtime from the
  378. currently executing task.
  379. - In fact, ``task.get_logger`` is no longer recommended, it is better
  380. to add a module-level logger to your tasks module.
  381. For example, like this:
  382. .. code-block:: python
  383. from celery.utils.log import get_task_logger
  384. logger = get_task_logger(__name__)
  385. @celery.task
  386. def add(x, y):
  387. logger.debug('Adding %r + %r' % (x, y))
  388. return x + y
  389. The resulting logger will then inherit from the ``"celery.task"`` logger
  390. so that the current task name and id is included in logging output.
  391. - Redirected output from stdout/stderr is now logged to a "celery.redirected"
  392. logger.
  393. - In addition a few warnings.warn have been replaced with logger.warn.
  394. - Now avoids the 'no handlers for logger multiprocessing' warning
  395. Task registry no longer global
  396. ------------------------------
  397. Every Celery instance now has its own task registry.
  398. You can make apps share registries by specifying it:
  399. .. code-block:: pycon
  400. >>> app1 = Celery()
  401. >>> app2 = Celery(tasks=app1.tasks)
  402. Note that tasks are shared between registries by default, so that
  403. tasks will be added to every subsequently created task registry.
  404. As an alternative tasks can be private to specific task registries
  405. by setting the ``shared`` argument to the ``@task`` decorator:
  406. .. code-block:: python
  407. @celery.task(shared=False)
  408. def add(x, y):
  409. return x + y
  410. Abstract tasks are now lazily bound.
  411. ------------------------------------
  412. The :class:`~celery.task.Task` class is no longer bound to an app
  413. by default, it will first be bound (and configured) when
  414. a concrete subclass is created.
  415. This means that you can safely import and make task base classes,
  416. without also initializing the app environment:
  417. .. code-block:: python
  418. from celery.task import Task
  419. class DebugTask(Task):
  420. abstract = True
  421. def __call__(self, *args, **kwargs):
  422. print('CALLING %r' % (self,))
  423. return self.run(*args, **kwargs)
  424. .. code-block:: pycon
  425. >>> DebugTask
  426. <unbound DebugTask>
  427. >>> @celery1.task(base=DebugTask)
  428. ... def add(x, y):
  429. ... return x + y
  430. >>> add.__class__
  431. <class add of <Celery default:0x101510d10>>
  432. Lazy task decorators
  433. --------------------
  434. The ``@task`` decorator is now lazy when used with custom apps.
  435. That is, if ``accept_magic_kwargs`` is enabled (herby called "compat mode"), the task
  436. decorator executes inline like before, however for custom apps the @task
  437. decorator now returns a special PromiseProxy object that is only evaluated
  438. on access.
  439. All promises will be evaluated when :meth:`@finalize` is called, or implicitly
  440. when the task registry is first used.
  441. Smart `--app` option
  442. --------------------
  443. The :option:`--app <celery --app>` option now 'auto-detects'
  444. - If the provided path is a module it tries to get an
  445. attribute named 'celery'.
  446. - If the provided path is a package it tries
  447. to import a submodule named 'celery',
  448. and get the celery attribute from that module.
  449. E.g. if you have a project named 'proj' where the
  450. celery app is located in 'from proj.celery import app',
  451. then the following will be equivalent:
  452. .. code-block:: console
  453. $ celery worker --app=proj
  454. $ celery worker --app=proj.celery:
  455. $ celery worker --app=proj.celery:app
  456. In Other News
  457. -------------
  458. - New :setting:`CELERYD_WORKER_LOST_WAIT` to control the timeout in
  459. seconds before :exc:`billiard.WorkerLostError` is raised
  460. when a worker can not be signaled (Issue #595).
  461. Contributed by Brendon Crawford.
  462. - Redis event monitor queues are now automatically deleted (Issue #436).
  463. - App instance factory methods have been converted to be cached
  464. descriptors that creates a new subclass on access.
  465. This means that e.g. ``app.Worker`` is an actual class
  466. and will work as expected when:
  467. .. code-block:: python
  468. class Worker(app.Worker):
  469. ...
  470. - New signal: :signal:`task_success`.
  471. - Multiprocessing logs are now only emitted if the :envvar:`MP_LOG`
  472. environment variable is set.
  473. - The Celery instance can now be created with a broker URL
  474. .. code-block:: python
  475. app = Celery(broker='redis://')
  476. - Result backends can now be set using an URL
  477. Currently only supported by redis. Example use:
  478. .. code-block:: python
  479. CELERY_RESULT_BACKEND = 'redis://localhost/1'
  480. - Heartbeat frequency now every 5s, and frequency sent with event
  481. The heartbeat frequency is now available in the worker event messages,
  482. so that clients can decide when to consider workers offline based on
  483. this value.
  484. - Module celery.actors has been removed, and will be part of cl instead.
  485. - Introduces new ``celery`` command, which is an entrypoint for all other
  486. commands.
  487. The main for this command can be run by calling ``celery.start()``.
  488. - Annotations now supports decorators if the key startswith '@'.
  489. E.g.:
  490. .. code-block:: python
  491. def debug_args(fun):
  492. @wraps(fun)
  493. def _inner(*args, **kwargs):
  494. print('ARGS: %r' % (args,))
  495. return _inner
  496. CELERY_ANNOTATIONS = {
  497. 'tasks.add': {'@__call__': debug_args},
  498. }
  499. Also tasks are now always bound by class so that
  500. annotated methods end up being bound.
  501. - Bugreport now available as a command and broadcast command
  502. - Get it from a Python repl:
  503. .. code-block:: pycon
  504. >>> import celery
  505. >>> print(celery.bugreport())
  506. - Using the ``celery`` command line program:
  507. .. code-block:: console
  508. $ celery report
  509. - Get it from remote workers:
  510. .. code-block:: console
  511. $ celery inspect report
  512. - Module ``celery.log`` moved to :mod:`celery.app.log`.
  513. - Module ``celery.task.control`` moved to :mod:`celery.app.control`.
  514. - New signal: :signal:`task_revoked`
  515. Sent in the main process when the task is revoked or terminated.
  516. - ``AsyncResult.task_id`` renamed to ``AsyncResult.id``
  517. - ``TasksetResult.taskset_id`` renamed to ``.id``
  518. - ``xmap(task, sequence)`` and ``xstarmap(task, sequence)``
  519. Returns a list of the results applying the task function to every item
  520. in the sequence.
  521. Example:
  522. .. code-block:: pycon
  523. >>> from celery import xstarmap
  524. >>> xstarmap(add, zip(range(10), range(10)).apply_async()
  525. [0, 2, 4, 6, 8, 10, 12, 14, 16, 18]
  526. - ``chunks(task, sequence, chunksize)``
  527. - ``group.skew(start=, stop=, step=)``
  528. Skew will skew the countdown for the individual tasks in a group,
  529. e.g. with a group:
  530. .. code-block:: pycon
  531. >>> g = group(add.s(i, i) for i in xrange(10))
  532. Skewing the tasks from 0 seconds to 10 seconds:
  533. .. code-block:: pycon
  534. >>> g.skew(stop=10)
  535. Will have the first task execute in 0 seconds, the second in 1 second,
  536. the third in 2 seconds and so on.
  537. - 99% test Coverage
  538. - :setting:`CELERY_QUEUES` can now be a list/tuple of :class:`~kombu.Queue`
  539. instances.
  540. Internally :attr:`@amqp.queues` is now a mapping of name/Queue instances,
  541. instead of converting on the fly.
  542. - Can now specify connection for :class:`@control.inspect`.
  543. .. code-block:: python
  544. from kombu import Connection
  545. i = celery.control.inspect(connection=Connection('redis://'))
  546. i.active_queues()
  547. - :setting:`CELERY_FORCE_EXECV` is now enabled by default.
  548. If the old behavior is wanted the setting can be set to False,
  549. or the new :option:`celery worker --no-execv` option.
  550. - Deprecated module ``celery.conf`` has been removed.
  551. - The :setting:`CELERY_TIMEZONE` now always require the :pypi:`pytz`
  552. library to be installed (exept if the timezone is set to `UTC`).
  553. - The Tokyo Tyrant backend has been removed and is no longer supported.
  554. - Now uses :func:`~kombu.common.maybe_declare` to cache queue declarations.
  555. - There is no longer a global default for the
  556. :setting:`CELERYBEAT_MAX_LOOP_INTERVAL` setting, it is instead
  557. set by individual schedulers.
  558. - Worker: now truncates very long message bodies in error reports.
  559. - No longer deepcopies exceptions when trying to serialize errors.
  560. - :envvar:`CELERY_BENCH` environment variable, will now also list
  561. memory usage statistics at worker shutdown.
  562. - Worker: now only ever use a single timer for all timing needs,
  563. and instead set different priorities.
  564. - An exceptions arguments are now safely pickled
  565. Contributed by Matt Long.
  566. - Worker/Celerybeat no longer logs the startup banner.
  567. Previously it would be logged with severity warning,
  568. now it's only written to stdout.
  569. - The ``contrib/`` directory in the distribution has been renamed to
  570. ``extra/``.
  571. - New signal: :signal:`task_revoked`
  572. - celery.contrib.migrate: Many improvements including
  573. filtering, queue migration, and support for acking messages on the broker
  574. migrating from.
  575. Contributed by John Watson.
  576. - Worker: Prefetch count increments are now optimized and grouped together.
  577. - Worker: No longer calls ``consume`` on the remote control command queue
  578. twice.
  579. Probably didn't cause any problems, but was unecessary.
  580. Internals
  581. ---------
  582. - ``app.broker_connection`` is now ``app.connection``
  583. Both names still work.
  584. - Compat modules are now generated dynamically upon use.
  585. These modules are ``celery.messaging``, ``celery.log``,
  586. ``celery.decorators`` and ``celery.registry``.
  587. - :mod:`celery.utils` refactored into multiple modules:
  588. :mod:`celery.utils.text`
  589. :mod:`celery.utils.imports`
  590. :mod:`celery.utils.functional`
  591. - Now using :mod:`kombu.utils.encoding` instead of
  592. :mod:`celery.utils.encoding`.
  593. - Renamed module ``celery.routes`` -> :mod:`celery.app.routes`.
  594. - Renamed package ``celery.db`` -> :mod:`celery.backends.database`.
  595. - Renamed module ``celery.abstract`` -> :mod:`celery.worker.bootsteps`.
  596. - Command line docs are now parsed from the module docstrings.
  597. - Test suite directory has been reorganized.
  598. - :program:`setup.py` now reads docs from the :file:`requirements/` directory.
  599. - Celery commands no longer wraps output (Issue #700).
  600. Contributed by Thomas Johansson.
  601. .. _v300-experimental:
  602. Experimental
  603. ============
  604. :mod:`celery.contrib.methods`: Task decorator for methods
  605. ----------------------------------------------------------
  606. This is an experimental module containing a task
  607. decorator, and a task decorator filter, that can be used
  608. to create tasks out of methods::
  609. from celery.contrib.methods import task_method
  610. class Counter(object):
  611. def __init__(self):
  612. self.value = 1
  613. @celery.task(name='Counter.increment', filter=task_method)
  614. def increment(self, n=1):
  615. self.value += 1
  616. return self.value
  617. See :mod:`celery.contrib.methods` for more information.
  618. .. _v300-unscheduled-removals:
  619. Unscheduled Removals
  620. ====================
  621. Usually we don't make backward incompatible removals,
  622. but these removals should have no major effect.
  623. - The following settings have been renamed:
  624. - ``CELERYD_ETA_SCHEDULER`` -> ``CELERYD_TIMER``
  625. - ``CELERYD_ETA_SCHEDULER_PRECISION`` -> ``CELERYD_TIMER_PRECISION``
  626. .. _v300-deprecations:
  627. Deprecations
  628. ============
  629. See the :ref:`deprecation-timeline`.
  630. - The ``celery.backends.pyredis`` compat module has been removed.
  631. Use :mod:`celery.backends.redis` instead!
  632. - The following undocumented API's has been moved:
  633. - ``control.inspect.add_consumer`` -> :meth:`@control.add_consumer`.
  634. - ``control.inspect.cancel_consumer`` -> :meth:`@control.cancel_consumer`.
  635. - ``control.inspect.enable_events`` -> :meth:`@control.enable_events`.
  636. - ``control.inspect.disable_events`` -> :meth:`@control.disable_events`.
  637. This way ``inspect()`` is only used for commands that do not
  638. modify anything, while idempotent control commands that make changes
  639. are on the control objects.
  640. Fixes
  641. =====
  642. - Retry sqlalchemy backend operations on DatabaseError/OperationalError
  643. (Issue #634)
  644. - Tasks that called ``retry`` was not acknowledged if acks late was enabled
  645. Fix contributed by David Markey.
  646. - The message priority argument was not properly propagated to Kombu
  647. (Issue #708).
  648. Fix contributed by Eran Rundstein