changelog-2.2.rst 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033
  1. .. _changelog-2.2:
  2. ===============================
  3. Change history for Celery 2.2
  4. ===============================
  5. .. contents::
  6. :local:
  7. .. _version-2.2.8:
  8. 2.2.8
  9. =====
  10. :release-date: 2011-11-25 04:00 P.M GMT
  11. :release-by: Ask Solem
  12. .. _v228-security-fixes:
  13. Security Fixes
  14. --------------
  15. * [Security: `CELERYSA-0001`_] Daemons would set effective id's rather than
  16. real id's when the :option:`--uid <celery --uid>`/
  17. :option:`--gid <celery --gid>` arguments to :program:`celery multi`,
  18. :program:`celeryd_detach`, :program:`celery beat` and
  19. :program:`celery events` were used.
  20. This means privileges weren't properly dropped, and that it would
  21. be possible to regain supervisor privileges later.
  22. .. _`CELERYSA-0001`:
  23. https://github.com/celery/celery/tree/master/docs/sec/CELERYSA-0001.txt
  24. .. _version-2.2.7:
  25. 2.2.7
  26. =====
  27. :release-date: 2011-06-13 04:00 P.M BST
  28. :release-by: Ask Solem
  29. * New signals: :signal:`after_setup_logger` and
  30. :signal:`after_setup_task_logger`
  31. These signals can be used to augment logging configuration
  32. after Celery has set up logging.
  33. * Redis result backend now works with Redis 2.4.4.
  34. * multi: The :option:`--gid <celery --gid>` option now works correctly.
  35. * worker: Retry wrongfully used the repr of the traceback instead
  36. of the string representation.
  37. * App.config_from_object: Now loads module, not attribute of module.
  38. * Fixed issue where logging of objects would give "<Unrepresentable: ...>"
  39. .. _version-2.2.6:
  40. 2.2.6
  41. =====
  42. :release-date: 2011-04-15 04:00 P.M CEST
  43. :release-by: Ask Solem
  44. .. _v226-important:
  45. Important Notes
  46. ---------------
  47. * Now depends on Kombu 1.1.2.
  48. * Dependency lists now explicitly specifies that we don't want
  49. :pypi:`python-dateutil` 2.x, as this version only supports Python 3.
  50. If you have installed dateutil 2.0 by accident you should downgrade
  51. to the 1.5.0 version:
  52. .. code-block:: console
  53. $ pip install -U python-dateutil==1.5.0
  54. or by ``easy_install``:
  55. .. code-block:: console
  56. $ easy_install -U python-dateutil==1.5.0
  57. .. _v226-fixes:
  58. Fixes
  59. -----
  60. * The new ``WatchedFileHandler`` broke Python 2.5 support (Issue #367).
  61. * Task: Don't use ``app.main`` if the task name is set explicitly.
  62. * Sending emails did not work on Python 2.5, due to a bug in
  63. the version detection code (Issue #378).
  64. * Beat: Adds method ``ScheduleEntry._default_now``
  65. This method can be overridden to change the default value
  66. of ``last_run_at``.
  67. * An error occurring in process cleanup could mask task errors.
  68. We no longer propagate errors happening at process cleanup,
  69. but log them instead. This way they will not interfere with publishing
  70. the task result (Issue #365).
  71. * Defining tasks did not work properly when using the Django
  72. ``shell_plus`` utility (Issue #366).
  73. * ``AsyncResult.get`` did not accept the ``interval`` and ``propagate``
  74. arguments.
  75. * worker: Fixed a bug where the worker would not shutdown if a
  76. :exc:`socket.error` was raised.
  77. .. _version-2.2.5:
  78. 2.2.5
  79. =====
  80. :release-date: 2011-03-28 06:00 P.M CEST
  81. :release-by: Ask Solem
  82. .. _v225-important:
  83. Important Notes
  84. ---------------
  85. * Now depends on Kombu 1.0.7
  86. .. _v225-news:
  87. News
  88. ----
  89. * Our documentation is now hosted by Read The Docs
  90. (http://docs.celeryproject.org), and all links have been changed to point to
  91. the new URL.
  92. * Logging: Now supports log rotation using external tools like `logrotate.d`_
  93. (Issue #321)
  94. This is accomplished by using the ``WatchedFileHandler``, which re-opens
  95. the file if it is renamed or deleted.
  96. .. _`logrotate.d`:
  97. http://www.ducea.com/2006/06/06/rotating-linux-log-files-part-2-logrotate/
  98. * ``otherqueues`` tutorial now documents how to configure Redis/Database result
  99. backends.
  100. * gevent: Now supports ETA tasks.
  101. But gevent still needs ``CELERY_DISABLE_RATE_LIMITS=True`` to work.
  102. * TaskSet User Guide: now contains TaskSet callback recipes.
  103. * Eventlet: New signals:
  104. * ``eventlet_pool_started``
  105. * ``eventlet_pool_preshutdown``
  106. * ``eventlet_pool_postshutdown``
  107. * ``eventlet_pool_apply``
  108. See :mod:`celery.signals` for more information.
  109. * New :setting:`BROKER_TRANSPORT_OPTIONS` setting can be used to pass
  110. additional arguments to a particular broker transport.
  111. * worker: ``worker_pid`` is now part of the request info as returned by
  112. broadcast commands.
  113. * TaskSet.apply/Taskset.apply_async now accepts an optional ``taskset_id``
  114. argument.
  115. * The taskset_id (if any) is now available in the Task request context.
  116. * SQLAlchemy result backend: taskset_id and taskset_id columns now have a
  117. unique constraint. (Tables need to recreated for this to take affect).
  118. * Task user guide: Added section about choosing a result backend.
  119. * Removed unused attribute ``AsyncResult.uuid``.
  120. .. _v225-fixes:
  121. Fixes
  122. -----
  123. * multiprocessing.Pool: Fixes race condition when marking job with
  124. ``WorkerLostError`` (Issue #268).
  125. The process may have published a result before it was terminated,
  126. but we have no reliable way to detect that this is the case.
  127. So we have to wait for 10 seconds before marking the result with
  128. WorkerLostError. This gives the result handler a chance to retrieve the
  129. result.
  130. * multiprocessing.Pool: Shutdown could hang if rate limits disabled.
  131. There was a race condition when the MainThread was waiting for the pool
  132. semaphore to be released. The ResultHandler now terminates after 5
  133. seconds if there are unacked jobs, but no worker processes left to start
  134. them (it needs to timeout because there could still be an ack+result
  135. that we haven't consumed from the result queue. It
  136. is unlikely we will receive any after 5 seconds with no worker processes).
  137. * ``celerybeat``: Now creates pidfile even if the ``--detach`` option is not set.
  138. * eventlet/gevent: The broadcast command consumer is now running in a separate
  139. green-thread.
  140. This ensures broadcast commands will take priority even if there are many
  141. active tasks.
  142. * Internal module ``celery.worker.controllers`` renamed to
  143. ``celery.worker.mediator``.
  144. * worker: Threads now terminates the program by calling ``os._exit``, as it
  145. is the only way to ensure exit in the case of syntax errors, or other
  146. unrecoverable errors.
  147. * Fixed typo in ``maybe_timedelta`` (Issue #352).
  148. * worker: Broadcast commands now logs with loglevel debug instead of warning.
  149. * AMQP Result Backend: Now resets cached channel if the connection is lost.
  150. * Polling results with the AMQP result backend was not working properly.
  151. * Rate limits: No longer sleeps if there are no tasks, but rather waits for
  152. the task received condition (Performance improvement).
  153. * ConfigurationView: ``iter(dict)`` should return keys, not items (Issue #362).
  154. * ``celerybeat``: PersistentScheduler now automatically removes a corrupted
  155. schedule file (Issue #346).
  156. * Programs that doesn't support positional command-line arguments now provides
  157. a user friendly error message.
  158. * Programs no longer tries to load the configuration file when showing
  159. ``--version`` (Issue #347).
  160. * Autoscaler: The "all processes busy" log message is now severity debug
  161. instead of error.
  162. * worker: If the message body can't be decoded, it is now passed through
  163. ``safe_str`` when logging.
  164. This to ensure we don't get additional decoding errors when trying to log
  165. the failure.
  166. * ``app.config_from_object``/``app.config_from_envvar`` now works for all
  167. loaders.
  168. * Now emits a user-friendly error message if the result backend name is
  169. unknown (Issue #349).
  170. * ``celery.contrib.batches``: Now sets loglevel and logfile in the task
  171. request so ``task.get_logger`` works with batch tasks (Issue #357).
  172. * worker: An exception was raised if using the amqp transport and the prefetch
  173. count value exceeded 65535 (Issue #359).
  174. The prefetch count is incremented for every received task with an
  175. ETA/countdown defined. The prefetch count is a short, so can only support
  176. a maximum value of 65535. If the value exceeds the maximum value we now
  177. disable the prefetch count, it is re-enabled as soon as the value is below
  178. the limit again.
  179. * ``cursesmon``: Fixed unbound local error (Issue #303).
  180. * eventlet/gevent is now imported on demand so autodoc can import the modules
  181. without having eventlet/gevent installed.
  182. * worker: Ack callback now properly handles ``AttributeError``.
  183. * ``Task.after_return`` is now always called *after* the result has been
  184. written.
  185. * Cassandra Result Backend: Should now work with the latest ``pycassa``
  186. version.
  187. * multiprocessing.Pool: No longer cares if the ``putlock`` semaphore is released
  188. too many times. (this can happen if one or more worker processes are
  189. killed).
  190. * SQLAlchemy Result Backend: Now returns accidentally removed ``date_done`` again
  191. (Issue #325).
  192. * Task.request context is now always initialized to ensure calling the task
  193. function directly works even if it actively uses the request context.
  194. * Exception occurring when iterating over the result from ``TaskSet.apply``
  195. fixed.
  196. * eventlet: Now properly schedules tasks with an ETA in the past.
  197. .. _version-2.2.4:
  198. 2.2.4
  199. =====
  200. :release-date: 2011-02-19 00:00 AM CET
  201. :release-by: Ask Solem
  202. .. _v224-fixes:
  203. Fixes
  204. -----
  205. * worker: 2.2.3 broke error logging, resulting in tracebacks not being logged.
  206. * AMQP result backend: Polling task states did not work properly if there were
  207. more than one result message in the queue.
  208. * ``TaskSet.apply_async()`` and ``TaskSet.apply()`` now supports an optional
  209. ``taskset_id`` keyword argument (Issue #331).
  210. * The current taskset id (if any) is now available in the task context as
  211. ``request.taskset`` (Issue #329).
  212. * SQLAlchemy result backend: `date_done` was no longer part of the results as it had
  213. been accidentally removed. It is now available again (Issue #325).
  214. * SQLAlchemy result backend: Added unique constraint on `Task.id` and
  215. `TaskSet.taskset_id`. Tables needs to be recreated for this to take effect.
  216. * Fixed exception raised when iterating on the result of ``TaskSet.apply()``.
  217. * Tasks user guide: Added section on choosing a result backend.
  218. .. _version-2.2.3:
  219. 2.2.3
  220. =====
  221. :release-date: 2011-02-12 04:00 P.M CET
  222. :release-by: Ask Solem
  223. .. _v223-fixes:
  224. Fixes
  225. -----
  226. * Now depends on Kombu 1.0.3
  227. * Task.retry now supports a ``max_retries`` argument, used to change the
  228. default value.
  229. * `multiprocessing.cpu_count` may raise :exc:`NotImplementedError` on
  230. platforms where this is not supported (Issue #320).
  231. * Coloring of log messages broke if the logged object was not a string.
  232. * Fixed several typos in the init-script documentation.
  233. * A regression caused `Task.exchange` and `Task.routing_key` to no longer
  234. have any effect. This is now fixed.
  235. * Routing user guide: Fixes typo, routers in :setting:`CELERY_ROUTES` must be
  236. instances, not classes.
  237. * :program:`celeryev` did not create pidfile even though the
  238. :option:`--pidfile <celery events --pidfile>` argument was set.
  239. * Task logger format was no longer used. (Issue #317).
  240. The id and name of the task is now part of the log message again.
  241. * A safe version of ``repr()`` is now used in strategic places to ensure
  242. objects with a broken ``__repr__`` does not crash the worker, or otherwise
  243. make errors hard to understand (Issue #298).
  244. * Remote control command :control:`active_queues`: did not account for queues added
  245. at runtime.
  246. In addition the dictionary replied by this command now has a different
  247. structure: the exchange key is now a dictionary containing the
  248. exchange declaration in full.
  249. * The :option:`celery worker -Q` option removed unused queue
  250. declarations, so routing of tasks could fail.
  251. Queues are no longer removed, but rather `app.amqp.queues.consume_from()`
  252. is used as the list of queues to consume from.
  253. This ensures all queues are available for routing purposes.
  254. * ``celeryctl``: Now supports the `inspect active_queues` command.
  255. .. _version-2.2.2:
  256. 2.2.2
  257. =====
  258. :release-date: 2011-02-03 04:00 P.M CET
  259. :release-by: Ask Solem
  260. .. _v222-fixes:
  261. Fixes
  262. -----
  263. * ``celerybeat`` could not read the schedule properly, so entries in
  264. :setting:`CELERYBEAT_SCHEDULE` would not be scheduled.
  265. * Task error log message now includes `exc_info` again.
  266. * The `eta` argument can now be used with `task.retry`.
  267. Previously it was overwritten by the countdown argument.
  268. * ``celery multi``/``celeryd_detach``: Now logs errors occurring when executing
  269. the `celery worker` command.
  270. * daemonizing tutorial: Fixed typo ``--time-limit 300`` ->
  271. ``--time-limit=300``
  272. * Colors in logging broke non-string objects in log messages.
  273. * ``setup_task_logger`` no longer makes assumptions about magic task kwargs.
  274. .. _version-2.2.1:
  275. 2.2.1
  276. =====
  277. :release-date: 2011-02-02 04:00 P.M CET
  278. :release-by: Ask Solem
  279. .. _v221-fixes:
  280. Fixes
  281. -----
  282. * Eventlet pool was leaking memory (Issue #308).
  283. * Deprecated function ``celery.execute.delay_task`` was accidentally removed,
  284. now available again.
  285. * ``BasePool.on_terminate`` stub did not exist
  286. * ``celeryd_detach``: Adds readable error messages if user/group name does not
  287. exist.
  288. * Smarter handling of unicode decode errors when logging errors.
  289. .. _version-2.2.0:
  290. 2.2.0
  291. =====
  292. :release-date: 2011-02-01 10:00 AM CET
  293. :release-by: Ask Solem
  294. .. _v220-important:
  295. Important Notes
  296. ---------------
  297. * Carrot has been replaced with `Kombu`_
  298. Kombu is the next generation messaging library for Python,
  299. fixing several flaws present in Carrot that was hard to fix
  300. without breaking backwards compatibility.
  301. Also it adds:
  302. * First-class support for virtual transports; Redis, Django ORM,
  303. SQLAlchemy, Beanstalk, MongoDB, CouchDB and in-memory.
  304. * Consistent error handling with introspection,
  305. * The ability to ensure that an operation is performed by gracefully
  306. handling connection and channel errors,
  307. * Message compression (:mod:`zlib`, :mod:`bz2`, or custom compression schemes).
  308. This means that `ghettoq` is no longer needed as the
  309. functionality it provided is already available in Celery by default.
  310. The virtual transports are also more feature complete with support
  311. for exchanges (direct and topic). The Redis transport even supports
  312. fanout exchanges so it is able to perform worker remote control
  313. commands.
  314. .. _`Kombu`: http://pypi.python.org/pypi/kombu
  315. * Magic keyword arguments pending deprecation.
  316. The magic keyword arguments were responsible for many problems
  317. and quirks: notably issues with tasks and decorators, and name
  318. collisions in keyword arguments for the unaware.
  319. It wasn't easy to find a way to deprecate the magic keyword arguments,
  320. but we think this is a solution that makes sense and it will not
  321. have any adverse effects for existing code.
  322. The path to a magic keyword argument free world is:
  323. * the `celery.decorators` module is deprecated and the decorators
  324. can now be found in `celery.task`.
  325. * The decorators in `celery.task` disables keyword arguments by
  326. default
  327. * All examples in the documentation have been changed to use
  328. `celery.task`.
  329. This means that the following will have magic keyword arguments
  330. enabled (old style):
  331. .. code-block:: python
  332. from celery.decorators import task
  333. @task()
  334. def add(x, y, **kwargs):
  335. print('In task %s' % kwargs['task_id'])
  336. return x + y
  337. And this will not use magic keyword arguments (new style):
  338. .. code-block:: python
  339. from celery.task import task
  340. @task()
  341. def add(x, y):
  342. print('In task %s' % add.request.id)
  343. return x + y
  344. In addition, tasks can choose not to accept magic keyword arguments by
  345. setting the `task.accept_magic_kwargs` attribute.
  346. .. admonition:: Deprecation
  347. Using the decorators in :mod:`celery.decorators` emits a
  348. :class:`PendingDeprecationWarning` with a helpful message urging
  349. you to change your code, in version 2.4 this will be replaced with
  350. a :class:`DeprecationWarning`, and in version 4.0 the
  351. :mod:`celery.decorators` module will be removed and no longer exist.
  352. Similarly, the `task.accept_magic_kwargs` attribute will no
  353. longer have any effect starting from version 4.0.
  354. * The magic keyword arguments are now available as `task.request`
  355. This is called *the context*. Using thread-local storage the
  356. context contains state that is related to the current request.
  357. It is mutable and you can add custom attributes that will only be seen
  358. by the current task request.
  359. The following context attributes are always available:
  360. ===================================== ===================================
  361. **Magic Keyword Argument** **Replace with**
  362. ===================================== ===================================
  363. `kwargs['task_id']` `self.request.id`
  364. `kwargs['delivery_info']` `self.request.delivery_info`
  365. `kwargs['task_retries']` `self.request.retries`
  366. `kwargs['logfile']` `self.request.logfile`
  367. `kwargs['loglevel']` `self.request.loglevel`
  368. `kwargs['task_is_eager']` `self.request.is_eager`
  369. **NEW** `self.request.args`
  370. **NEW** `self.request.kwargs`
  371. ===================================== ===================================
  372. In addition, the following methods now automatically uses the current
  373. context, so you don't have to pass `kwargs` manually anymore:
  374. * `task.retry`
  375. * `task.get_logger`
  376. * `task.update_state`
  377. * `Eventlet`_ support.
  378. This is great news for I/O-bound tasks!
  379. To change pool implementations you use the :option:`celery worker --pool`
  380. argument, or globally using the
  381. :setting:`CELERYD_POOL` setting. This can be the full name of a class,
  382. or one of the following aliases: `processes`, `eventlet`, `gevent`.
  383. For more information please see the :ref:`concurrency-eventlet` section
  384. in the User Guide.
  385. .. admonition:: Why not gevent?
  386. For our first alternative concurrency implementation we have focused
  387. on `Eventlet`_, but there is also an experimental `gevent`_ pool
  388. available. This is missing some features, notably the ability to
  389. schedule ETA tasks.
  390. Hopefully the `gevent`_ support will be feature complete by
  391. version 2.3, but this depends on user demand (and contributions).
  392. .. _`Eventlet`: http://eventlet.net
  393. .. _`gevent`: http://gevent.org
  394. * Python 2.4 support deprecated!
  395. We're happy^H^H^H^H^Hsad to announce that this is the last version
  396. to support Python 2.4.
  397. You are urged to make some noise if you're currently stuck with
  398. Python 2.4. Complain to your package maintainers, sysadmins and bosses:
  399. tell them it's time to move on!
  400. Apart from wanting to take advantage of :keyword:`with` statements,
  401. coroutines, conditional expressions and enhanced :keyword:`try` blocks,
  402. the code base now contains so many 2.4 related hacks and workarounds
  403. it's no longer just a compromise, but a sacrifice.
  404. If it really isn't your choice, and you don't have the option to upgrade
  405. to a newer version of Python, you can just continue to use Celery 2.2.
  406. Important fixes can be back ported for as long as there is interest.
  407. * worker: Now supports Autoscaling of child worker processes.
  408. The ``--autoscale`` option can be used
  409. to configure the minimum and maximum number of child worker processes:
  410. .. code-block:: text
  411. --autoscale=AUTOSCALE
  412. Enable autoscaling by providing
  413. max_concurrency,min_concurrency. Example:
  414. --autoscale=10,3 (always keep 3 processes, but grow to
  415. 10 if necessary).
  416. * Remote Debugging of Tasks
  417. ``celery.contrib.rdb`` is an extended version of :mod:`pdb` that
  418. enables remote debugging of processes that does not have terminal
  419. access.
  420. Example usage:
  421. .. code-block:: text
  422. from celery.contrib import rdb
  423. from celery.task import task
  424. @task()
  425. def add(x, y):
  426. result = x + y
  427. # set breakpoint
  428. rdb.set_trace()
  429. return result
  430. :func:`~celery.contrib.rdb.set_trace` sets a breakpoint at the current
  431. location and creates a socket you can telnet into to remotely debug
  432. your task.
  433. The debugger may be started by multiple processes at the same time,
  434. so rather than using a fixed port the debugger will search for an
  435. available port, starting from the base port (6900 by default).
  436. The base port can be changed using the environment variable
  437. :envvar:`CELERY_RDB_PORT`.
  438. By default the debugger will only be available from the local host,
  439. to enable access from the outside you have to set the environment
  440. variable :envvar:`CELERY_RDB_HOST`.
  441. When the worker encounters your breakpoint it will log the following
  442. information::
  443. [INFO/MainProcess] Received task:
  444. tasks.add[d7261c71-4962-47e5-b342-2448bedd20e8]
  445. [WARNING/PoolWorker-1] Remote Debugger:6900:
  446. Please telnet 127.0.0.1 6900. Type `exit` in session to continue.
  447. [2011-01-18 14:25:44,119: WARNING/PoolWorker-1] Remote Debugger:6900:
  448. Waiting for client...
  449. If you telnet the port specified you will be presented
  450. with a ``pdb`` shell:
  451. .. code-block:: console
  452. $ telnet localhost 6900
  453. Connected to localhost.
  454. Escape character is '^]'.
  455. > /opt/devel/demoapp/tasks.py(128)add()
  456. -> return result
  457. (Pdb)
  458. Enter ``help`` to get a list of available commands,
  459. It may be a good idea to read the `Python Debugger Manual`_ if
  460. you have never used `pdb` before.
  461. .. _`Python Debugger Manual`: http://docs.python.org/library/pdb.html
  462. * Events are now transient and is using a topic exchange (instead of direct).
  463. The `CELERYD_EVENT_EXCHANGE`, `CELERYD_EVENT_ROUTING_KEY`,
  464. `CELERYD_EVENT_EXCHANGE_TYPE` settings are no longer in use.
  465. This means events will not be stored until there is a consumer, and the
  466. events will be gone as soon as the consumer stops. Also it means there
  467. can be multiple monitors running at the same time.
  468. The routing key of an event is the type of event (e.g. `worker.started`,
  469. `worker.heartbeat`, `task.succeeded`, etc. This means a consumer can
  470. filter on specific types, to only be alerted of the events it cares about.
  471. Each consumer will create a unique queue, meaning it is in effect a
  472. broadcast exchange.
  473. This opens up a lot of possibilities, for example the workers could listen
  474. for worker events to know what workers are in the neighborhood, and even
  475. restart workers when they go down (or use this information to optimize
  476. tasks/autoscaling).
  477. .. note::
  478. The event exchange has been renamed from ``"celeryevent"``
  479. to ``"celeryev"`` so it does not collide with older versions.
  480. If you would like to remove the old exchange you can do so
  481. by executing the following command:
  482. .. code-block:: console
  483. $ camqadm exchange.delete celeryevent
  484. * The worker now starts without configuration, and configuration can be
  485. specified directly on the command-line.
  486. Configuration options must appear after the last argument, separated
  487. by two dashes:
  488. .. code-block:: console
  489. $ celery worker -l info -I tasks -- broker.host=localhost broker.vhost=/app
  490. * Configuration is now an alias to the original configuration, so changes
  491. to the original will reflect Celery at runtime.
  492. * `celery.conf` has been deprecated, and modifying `celery.conf.ALWAYS_EAGER`
  493. will no longer have any effect.
  494. The default configuration is now available in the
  495. :mod:`celery.app.defaults` module. The available configuration options
  496. and their types can now be introspected.
  497. * Remote control commands are now provided by `kombu.pidbox`, the generic
  498. process mailbox.
  499. * Internal module `celery.worker.listener` has been renamed to
  500. `celery.worker.consumer`, and `.CarrotListener` is now `.Consumer`.
  501. * Previously deprecated modules `celery.models` and
  502. `celery.management.commands` have now been removed as per the deprecation
  503. time-line.
  504. * [Security: Low severity] Removed `celery.task.RemoteExecuteTask` and
  505. accompanying functions: `dmap`, `dmap_async`, and `execute_remote`.
  506. Executing arbitrary code using pickle is a potential security issue if
  507. someone gains unrestricted access to the message broker.
  508. If you really need this functionality, then you would have to add
  509. this to your own project.
  510. * [Security: Low severity] The `stats` command no longer transmits the
  511. broker password.
  512. One would have needed an authenticated broker connection to receive
  513. this password in the first place, but sniffing the password at the
  514. wire level would have been possible if using unencrypted communication.
  515. .. _v220-news:
  516. News
  517. ----
  518. * The internal module `celery.task.builtins` has been removed.
  519. * The module `celery.task.schedules` is deprecated, and
  520. `celery.schedules` should be used instead.
  521. For example if you have::
  522. from celery.task.schedules import crontab
  523. You should replace that with::
  524. from celery.schedules import crontab
  525. The module needs to be renamed because it must be possible
  526. to import schedules without importing the `celery.task` module.
  527. * The following functions have been deprecated and is scheduled for
  528. removal in version 2.3:
  529. * `celery.execute.apply_async`
  530. Use `task.apply_async()` instead.
  531. * `celery.execute.apply`
  532. Use `task.apply()` instead.
  533. * `celery.execute.delay_task`
  534. Use `registry.tasks[name].delay()` instead.
  535. * Importing `TaskSet` from `celery.task.base` is now deprecated.
  536. You should use::
  537. >>> from celery.task import TaskSet
  538. instead.
  539. * New remote control commands:
  540. * `active_queues`
  541. Returns the queue declarations a worker is currently consuming from.
  542. * Added the ability to retry publishing the task message in
  543. the event of connection loss or failure.
  544. This is disabled by default but can be enabled using the
  545. :setting:`CELERY_TASK_PUBLISH_RETRY` setting, and tweaked by
  546. the :setting:`CELERY_TASK_PUBLISH_RETRY_POLICY` setting.
  547. In addition `retry`, and `retry_policy` keyword arguments have
  548. been added to `Task.apply_async`.
  549. .. note::
  550. Using the `retry` argument to `apply_async` requires you to
  551. handle the publisher/connection manually.
  552. * Periodic Task classes (`@periodic_task`/`PeriodicTask`) will *not* be
  553. deprecated as previously indicated in the source code.
  554. But you are encouraged to use the more flexible
  555. :setting:`CELERYBEAT_SCHEDULE` setting.
  556. * Built-in daemonization support of the worker using `celery multi`
  557. is no longer experimental and is considered production quality.
  558. See :ref:`daemon-generic` if you want to use the new generic init
  559. scripts.
  560. * Added support for message compression using the
  561. :setting:`CELERY_MESSAGE_COMPRESSION` setting, or the `compression` argument
  562. to `apply_async`. This can also be set using routers.
  563. * worker: Now logs stack-trace of all threads when receiving the
  564. `SIGUSR1` signal. (Does not work on CPython 2.4, Windows or Jython).
  565. Inspired by https://gist.github.com/737056
  566. * Can now remotely terminate/kill the worker process currently processing
  567. a task.
  568. The `revoke` remote control command now supports a `terminate` argument
  569. Default signal is `TERM`, but can be specified using the `signal`
  570. argument. Signal can be the uppercase name of any signal defined
  571. in the :mod:`signal` module in the Python Standard Library.
  572. Terminating a task also revokes it.
  573. Example::
  574. >>> from celery.task.control import revoke
  575. >>> revoke(task_id, terminate=True)
  576. >>> revoke(task_id, terminate=True, signal='KILL')
  577. >>> revoke(task_id, terminate=True, signal='SIGKILL')
  578. * `TaskSetResult.join_native`: Backend-optimized version of `join()`.
  579. If available, this version uses the backends ability to retrieve
  580. multiple results at once, unlike `join()` which fetches the results
  581. one by one.
  582. So far only supported by the AMQP result backend. Support for Memcached
  583. and Redis may be added later.
  584. * Improved implementations of `TaskSetResult.join` and `AsyncResult.wait`.
  585. An `interval` keyword argument have been added to both so the
  586. polling interval can be specified (default interval is 0.5 seconds).
  587. A `propagate` keyword argument have been added to `result.wait()`,
  588. errors will be returned instead of raised if this is set to False.
  589. .. warning::
  590. You should decrease the polling interval when using the database
  591. result backend, as frequent polling can result in high database load.
  592. * The PID of the child worker process accepting a task is now sent as a field
  593. with the :event:`task-started` event.
  594. * The following fields have been added to all events in the worker class:
  595. * `sw_ident`: Name of worker software (e.g. ``"py-celery"``).
  596. * `sw_ver`: Software version (e.g. 2.2.0).
  597. * `sw_sys`: Operating System (e.g. Linux, Windows, Darwin).
  598. * For better accuracy the start time reported by the multiprocessing worker
  599. process is used when calculating task duration.
  600. Previously the time reported by the accept callback was used.
  601. * `celerybeat`: New built-in daemonization support using the `--detach`
  602. option.
  603. * `celeryev`: New built-in daemonization support using the `--detach`
  604. option.
  605. * `TaskSet.apply_async`: Now supports custom publishers by using the
  606. `publisher` argument.
  607. * Added :setting:`CELERY_SEND_TASK_SENT_EVENT` setting.
  608. If enabled an event will be sent with every task, so monitors can
  609. track tasks before the workers receive them.
  610. * `celerybeat`: Now reuses the broker connection when calling
  611. scheduled tasks.
  612. * The configuration module and loader to use can now be specified on
  613. the command-line.
  614. For example:
  615. .. code-block:: console
  616. $ celery worker --config=celeryconfig.py --loader=myloader.Loader
  617. * Added signals: `beat_init` and `beat_embedded_init`
  618. * :signal:`celery.signals.beat_init`
  619. Dispatched when :program:`celerybeat` starts (either standalone or
  620. embedded). Sender is the :class:`celery.beat.Service` instance.
  621. * :signal:`celery.signals.beat_embedded_init`
  622. Dispatched in addition to the :signal:`beat_init` signal when
  623. :program:`celerybeat` is started as an embedded process. Sender
  624. is the :class:`celery.beat.Service` instance.
  625. * Redis result backend: Removed deprecated settings `REDIS_TIMEOUT` and
  626. `REDIS_CONNECT_RETRY`.
  627. * CentOS init-script for :program:`celery worker` now available in `extra/centos`.
  628. * Now depends on :pypi:`pyparsing` version 1.5.0 or higher.
  629. There have been reported issues using Celery with :pypi:`pyparsing` 1.4.x,
  630. so please upgrade to the latest version.
  631. * Lots of new unit tests written, now with a total coverage of 95%.
  632. .. _v220-fixes:
  633. Fixes
  634. -----
  635. * `celeryev` Curses Monitor: Improved resize handling and UI layout
  636. (Issue #274 + Issue #276)
  637. * AMQP Backend: Exceptions occurring while sending task results are now
  638. propagated instead of silenced.
  639. the worker will then show the full traceback of these errors in the log.
  640. * AMQP Backend: No longer deletes the result queue after successful
  641. poll, as this should be handled by the
  642. :setting:`CELERY_AMQP_TASK_RESULT_EXPIRES` setting instead.
  643. * AMQP Backend: Now ensures queues are declared before polling results.
  644. * Windows: worker: Show error if running with `-B` option.
  645. Running ``celerybeat`` embedded is known not to work on Windows, so
  646. users are encouraged to run ``celerybeat`` as a separate service instead.
  647. * Windows: Utilities no longer output ANSI color codes on Windows
  648. * ``camqadm``: Now properly handles :kbd:`Control-c` by simply exiting instead
  649. of showing confusing traceback.
  650. * Windows: All tests are now passing on Windows.
  651. * Remove bin/ directory, and `scripts` section from :file:`setup.py`.
  652. This means we now rely completely on setuptools entry-points.
  653. .. _v220-experimental:
  654. Experimental
  655. ------------
  656. * Jython: worker now runs on Jython using the threaded pool.
  657. All tests pass, but there may still be bugs lurking around the corners.
  658. * PyPy: worker now runs on PyPy.
  659. It runs without any pool, so to get parallel execution you must start
  660. multiple instances (e.g. using :program:`multi`).
  661. Sadly an initial benchmark seems to show a 30% performance decrease on
  662. ``pypy-1.4.1`` + JIT. We would like to find out why this is, so stay tuned.
  663. * :class:`PublisherPool`: Experimental pool of task publishers and
  664. connections to be used with the `retry` argument to `apply_async`.
  665. The example code below will re-use connections and channels, and
  666. retry sending of the task message if the connection is lost.
  667. .. code-block:: python
  668. from celery import current_app
  669. # Global pool
  670. pool = current_app().amqp.PublisherPool(limit=10)
  671. def my_view(request):
  672. with pool.acquire() as publisher:
  673. add.apply_async((2, 2), publisher=publisher, retry=True)