whatsnew-3.0.rst 29 KB

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