changelog-2.2.rst 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031
  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 :pypi:`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 didn't 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 won't interfere with publishing
  70. the task result (Issue #365).
  71. * Defining tasks didn't work properly when using the Django
  72. ``shell_plus`` utility (Issue #366).
  73. * ``AsyncResult.get`` didn't accept the ``interval`` and ``propagate``
  74. arguments.
  75. * worker: Fixed a bug where the worker wouldn't 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's 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'll receive any after 5 seconds with no worker processes).
  137. * ``celerybeat``: Now creates pidfile even if the ``--detach`` option isn't 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 wasn't 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's 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's 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 didn't 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's 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 :pypi:`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 isn't supported (Issue #320).
  231. * Coloring of log messages broke if the logged object wasn't 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` didn't 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__`` doesn't crash the worker, or otherwise
  243. make errors hard to understand (Issue #298).
  244. * Remote control command :control:`active_queues`: didn't 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`` couldn't read the schedule properly, so entries in
  264. :setting:`CELERYBEAT_SCHEDULE` wouldn't 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 didn't exist
  286. * ``celeryd_detach``: Adds readable error messages if user/group name
  287. doesn't 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 :pypi:`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's able to perform worker remote control
  313. commands.
  314. * Magic keyword arguments pending deprecation.
  315. The magic keyword arguments were responsible for many problems
  316. and quirks: notably issues with tasks and decorators, and name
  317. collisions in keyword arguments for the unaware.
  318. It wasn't easy to find a way to deprecate the magic keyword arguments,
  319. but we think this is a solution that makes sense and it won't
  320. have any adverse effects for existing code.
  321. The path to a magic keyword argument free world is:
  322. * the `celery.decorators` module is deprecated and the decorators
  323. can now be found in `celery.task`.
  324. * The decorators in `celery.task` disables keyword arguments by
  325. default
  326. * All examples in the documentation have been changed to use
  327. `celery.task`.
  328. This means that the following will have magic keyword arguments
  329. enabled (old style):
  330. .. code-block:: python
  331. from celery.decorators import task
  332. @task()
  333. def add(x, y, **kwargs):
  334. print('In task %s' % kwargs['task_id'])
  335. return x + y
  336. And this won't use magic keyword arguments (new style):
  337. .. code-block:: python
  338. from celery.task import task
  339. @task()
  340. def add(x, y):
  341. print('In task %s' % add.request.id)
  342. return x + y
  343. In addition, tasks can choose not to accept magic keyword arguments by
  344. setting the `task.accept_magic_kwargs` attribute.
  345. .. admonition:: Deprecation
  346. Using the decorators in :mod:`celery.decorators` emits a
  347. :class:`PendingDeprecationWarning` with a helpful message urging
  348. you to change your code, in version 2.4 this will be replaced with
  349. a :class:`DeprecationWarning`, and in version 4.0 the
  350. :mod:`celery.decorators` module will be removed and no longer exist.
  351. Similarly, the `task.accept_magic_kwargs` attribute will no
  352. longer have any effect starting from version 4.0.
  353. * The magic keyword arguments are now available as `task.request`
  354. This is called *the context*. Using thread-local storage the
  355. context contains state that's related to the current request.
  356. It's mutable and you can add custom attributes that'll only be seen
  357. by the current task request.
  358. The following context attributes are always available:
  359. ===================================== ===================================
  360. **Magic Keyword Argument** **Replace with**
  361. ===================================== ===================================
  362. `kwargs['task_id']` `self.request.id`
  363. `kwargs['delivery_info']` `self.request.delivery_info`
  364. `kwargs['task_retries']` `self.request.retries`
  365. `kwargs['logfile']` `self.request.logfile`
  366. `kwargs['loglevel']` `self.request.loglevel`
  367. `kwargs['task_is_eager']` `self.request.is_eager`
  368. **NEW** `self.request.args`
  369. **NEW** `self.request.kwargs`
  370. ===================================== ===================================
  371. In addition, the following methods now automatically uses the current
  372. context, so you don't have to pass `kwargs` manually anymore:
  373. * `task.retry`
  374. * `task.get_logger`
  375. * `task.update_state`
  376. * `Eventlet`_ support.
  377. This is great news for I/O-bound tasks!
  378. To change pool implementations you use the :option:`celery worker --pool`
  379. argument, or globally using the
  380. :setting:`CELERYD_POOL` setting. This can be the full name of a class,
  381. or one of the following aliases: `processes`, `eventlet`, `gevent`.
  382. For more information please see the :ref:`concurrency-eventlet` section
  383. in the User Guide.
  384. .. admonition:: Why not gevent?
  385. For our first alternative concurrency implementation we've focused
  386. on `Eventlet`_, but there's also an experimental `gevent`_ pool
  387. available. This is missing some features, notably the ability to
  388. schedule ETA tasks.
  389. Hopefully the `gevent`_ support will be feature complete by
  390. version 2.3, but this depends on user demand (and contributions).
  391. .. _`Eventlet`: http://eventlet.net
  392. .. _`gevent`: http://gevent.org
  393. * Python 2.4 support deprecated!
  394. We're happy^H^H^H^H^Hsad to announce that this is the last version
  395. to support Python 2.4.
  396. You're urged to make some noise if you're currently stuck with
  397. Python 2.4. Complain to your package maintainers, sysadmins and bosses:
  398. tell them it's time to move on!
  399. Apart from wanting to take advantage of :keyword:`with` statements,
  400. coroutines, conditional expressions and enhanced :keyword:`try` blocks,
  401. the code base now contains so many 2.4 related hacks and workarounds
  402. it's no longer just a compromise, but a sacrifice.
  403. If it really isn't your choice, and you don't have the option to upgrade
  404. to a newer version of Python, you can just continue to use Celery 2.2.
  405. Important fixes can be back ported for as long as there's interest.
  406. * worker: Now supports Autoscaling of child worker processes.
  407. The :option:`--autoscale <celery worker --autoscale>` option can be used
  408. to configure the minimum and maximum number of child worker processes:
  409. .. code-block:: text
  410. --autoscale=AUTOSCALE
  411. Enable autoscaling by providing
  412. max_concurrency,min_concurrency. Example:
  413. --autoscale=10,3 (always keep 3 processes, but grow to
  414. 10 if necessary).
  415. * Remote Debugging of Tasks
  416. ``celery.contrib.rdb`` is an extended version of :mod:`pdb` that
  417. enables remote debugging of processes that doesn't have terminal
  418. access.
  419. Example usage:
  420. .. code-block:: text
  421. from celery.contrib import rdb
  422. from celery.task import task
  423. @task()
  424. def add(x, y):
  425. result = x + y
  426. # set breakpoint
  427. rdb.set_trace()
  428. return result
  429. :func:`~celery.contrib.rdb.set_trace` sets a breakpoint at the current
  430. location and creates a socket you can telnet into to remotely debug
  431. your task.
  432. The debugger may be started by multiple processes at the same time,
  433. so rather than using a fixed port the debugger will search for an
  434. available port, starting from the base port (6900 by default).
  435. The base port can be changed using the environment variable
  436. :envvar:`CELERY_RDB_PORT`.
  437. By default the debugger will only be available from the local host,
  438. to enable access from the outside you have to set the environment
  439. variable :envvar:`CELERY_RDB_HOST`.
  440. When the worker encounters your breakpoint it will log the following
  441. information::
  442. [INFO/MainProcess] Received task:
  443. tasks.add[d7261c71-4962-47e5-b342-2448bedd20e8]
  444. [WARNING/PoolWorker-1] Remote Debugger:6900:
  445. Please telnet 127.0.0.1 6900. Type `exit` in session to continue.
  446. [2011-01-18 14:25:44,119: WARNING/PoolWorker-1] Remote Debugger:6900:
  447. Waiting for client...
  448. If you telnet the port specified you'll be presented
  449. with a ``pdb`` shell:
  450. .. code-block:: console
  451. $ telnet localhost 6900
  452. Connected to localhost.
  453. Escape character is '^]'.
  454. > /opt/devel/demoapp/tasks.py(128)add()
  455. -> return result
  456. (Pdb)
  457. Enter ``help`` to get a list of available commands,
  458. It may be a good idea to read the `Python Debugger Manual`_ if
  459. you have never used `pdb` before.
  460. .. _`Python Debugger Manual`: http://docs.python.org/library/pdb.html
  461. * Events are now transient and is using a topic exchange (instead of direct).
  462. The `CELERYD_EVENT_EXCHANGE`, `CELERYD_EVENT_ROUTING_KEY`,
  463. `CELERYD_EVENT_EXCHANGE_TYPE` settings are no longer in use.
  464. This means events won't be stored until there's a consumer, and the
  465. events will be gone as soon as the consumer stops. Also it means there
  466. can be multiple monitors running at the same time.
  467. The routing key of an event is the type of event (e.g., `worker.started`,
  468. `worker.heartbeat`, `task.succeeded`, etc. This means a consumer can
  469. filter on specific types, to only be alerted of the events it cares about.
  470. Each consumer will create a unique queue, meaning it's in effect a
  471. broadcast exchange.
  472. This opens up a lot of possibilities, for example the workers could listen
  473. for worker events to know what workers are in the neighborhood, and even
  474. restart workers when they go down (or use this information to optimize
  475. tasks/autoscaling).
  476. .. note::
  477. The event exchange has been renamed from ``"celeryevent"``
  478. to ``"celeryev"`` so it doesn't collide with older versions.
  479. If you'd like to remove the old exchange you can do so
  480. by executing the following command:
  481. .. code-block:: console
  482. $ camqadm exchange.delete celeryevent
  483. * The worker now starts without configuration, and configuration can be
  484. specified directly on the command-line.
  485. Configuration options must appear after the last argument, separated
  486. by two dashes:
  487. .. code-block:: console
  488. $ celery worker -l info -I tasks -- broker.host=localhost broker.vhost=/app
  489. * Configuration is now an alias to the original configuration, so changes
  490. to the original will reflect Celery at runtime.
  491. * `celery.conf` has been deprecated, and modifying `celery.conf.ALWAYS_EAGER`
  492. will no longer have any effect.
  493. The default configuration is now available in the
  494. :mod:`celery.app.defaults` module. The available configuration options
  495. and their types can now be introspected.
  496. * Remote control commands are now provided by `kombu.pidbox`, the generic
  497. process mailbox.
  498. * Internal module `celery.worker.listener` has been renamed to
  499. `celery.worker.consumer`, and `.CarrotListener` is now `.Consumer`.
  500. * Previously deprecated modules `celery.models` and
  501. `celery.management.commands` have now been removed as per the deprecation
  502. time-line.
  503. * [Security: Low severity] Removed `celery.task.RemoteExecuteTask` and
  504. accompanying functions: `dmap`, `dmap_async`, and `execute_remote`.
  505. Executing arbitrary code using pickle is a potential security issue if
  506. someone gains unrestricted access to the message broker.
  507. If you really need this functionality, then you'd've to add
  508. this to your own project.
  509. * [Security: Low severity] The `stats` command no longer transmits the
  510. broker password.
  511. One would've needed an authenticated broker connection to receive
  512. this password in the first place, but sniffing the password at the
  513. wire level would've been possible if using unencrypted communication.
  514. .. _v220-news:
  515. News
  516. ----
  517. * The internal module `celery.task.builtins` has been removed.
  518. * The module `celery.task.schedules` is deprecated, and
  519. `celery.schedules` should be used instead.
  520. For example if you have::
  521. from celery.task.schedules import crontab
  522. You should replace that with::
  523. from celery.schedules import crontab
  524. The module needs to be renamed because it must be possible
  525. to import schedules without importing the `celery.task` module.
  526. * The following functions have been deprecated and is scheduled for
  527. removal in version 2.3:
  528. * `celery.execute.apply_async`
  529. Use `task.apply_async()` instead.
  530. * `celery.execute.apply`
  531. Use `task.apply()` instead.
  532. * `celery.execute.delay_task`
  533. Use `registry.tasks[name].delay()` instead.
  534. * Importing `TaskSet` from `celery.task.base` is now deprecated.
  535. You should use::
  536. >>> from celery.task import TaskSet
  537. instead.
  538. * New remote control commands:
  539. * `active_queues`
  540. Returns the queue declarations a worker is currently consuming from.
  541. * Added the ability to retry publishing the task message in
  542. the event of connection loss or failure.
  543. This is disabled by default but can be enabled using the
  544. :setting:`CELERY_TASK_PUBLISH_RETRY` setting, and tweaked by
  545. the :setting:`CELERY_TASK_PUBLISH_RETRY_POLICY` setting.
  546. In addition `retry`, and `retry_policy` keyword arguments have
  547. been added to `Task.apply_async`.
  548. .. note::
  549. Using the `retry` argument to `apply_async` requires you to
  550. handle the publisher/connection manually.
  551. * Periodic Task classes (`@periodic_task`/`PeriodicTask`) will *not* be
  552. deprecated as previously indicated in the source code.
  553. But you're encouraged to use the more flexible
  554. :setting:`CELERYBEAT_SCHEDULE` setting.
  555. * Built-in daemonization support of the worker using `celery multi`
  556. is no longer experimental and is considered production quality.
  557. See :ref:`daemon-generic` if you want to use the new generic init
  558. scripts.
  559. * Added support for message compression using the
  560. :setting:`CELERY_MESSAGE_COMPRESSION` setting, or the `compression` argument
  561. to `apply_async`. This can also be set using routers.
  562. * worker: Now logs stack-trace of all threads when receiving the
  563. `SIGUSR1` signal (doesn't work on CPython 2.4, Windows or Jython).
  564. Inspired by https://gist.github.com/737056
  565. * Can now remotely terminate/kill the worker process currently processing
  566. a task.
  567. The `revoke` remote control command now supports a `terminate` argument
  568. Default signal is `TERM`, but can be specified using the `signal`
  569. argument. Signal can be the uppercase name of any signal defined
  570. in the :mod:`signal` module in the Python Standard Library.
  571. Terminating a task also revokes it.
  572. Example::
  573. >>> from celery.task.control import revoke
  574. >>> revoke(task_id, terminate=True)
  575. >>> revoke(task_id, terminate=True, signal='KILL')
  576. >>> revoke(task_id, terminate=True, signal='SIGKILL')
  577. * `TaskSetResult.join_native`: Backend-optimized version of `join()`.
  578. If available, this version uses the backends ability to retrieve
  579. multiple results at once, unlike `join()` which fetches the results
  580. one by one.
  581. So far only supported by the AMQP result backend. Support for Memcached
  582. and Redis may be added later.
  583. * Improved implementations of `TaskSetResult.join` and `AsyncResult.wait`.
  584. An `interval` keyword argument have been added to both so the
  585. polling interval can be specified (default interval is 0.5 seconds).
  586. A `propagate` keyword argument have been added to `result.wait()`,
  587. errors will be returned instead of raised if this is set to False.
  588. .. warning::
  589. You should decrease the polling interval when using the database
  590. result backend, as frequent polling can result in high database load.
  591. * The PID of the child worker process accepting a task is now sent as a field
  592. with the :event:`task-started` event.
  593. * The following fields have been added to all events in the worker class:
  594. * `sw_ident`: Name of worker software (e.g., ``"py-celery"``).
  595. * `sw_ver`: Software version (e.g., 2.2.0).
  596. * `sw_sys`: Operating System (e.g., Linux, Windows, Darwin).
  597. * For better accuracy the start time reported by the multiprocessing worker
  598. process is used when calculating task duration.
  599. Previously the time reported by the accept callback was used.
  600. * `celerybeat`: New built-in daemonization support using the `--detach`
  601. option.
  602. * `celeryev`: New built-in daemonization support using the `--detach`
  603. option.
  604. * `TaskSet.apply_async`: Now supports custom publishers by using the
  605. `publisher` argument.
  606. * Added :setting:`CELERY_SEND_TASK_SENT_EVENT` setting.
  607. If enabled an event will be sent with every task, so monitors can
  608. track tasks before the workers receive them.
  609. * `celerybeat`: Now reuses the broker connection when calling
  610. scheduled tasks.
  611. * The configuration module and loader to use can now be specified on
  612. the command-line.
  613. For example:
  614. .. code-block:: console
  615. $ celery worker --config=celeryconfig.py --loader=myloader.Loader
  616. * Added signals: `beat_init` and `beat_embedded_init`
  617. * :signal:`celery.signals.beat_init`
  618. Dispatched when :program:`celerybeat` starts (either standalone or
  619. embedded). Sender is the :class:`celery.beat.Service` instance.
  620. * :signal:`celery.signals.beat_embedded_init`
  621. Dispatched in addition to the :signal:`beat_init` signal when
  622. :program:`celerybeat` is started as an embedded process. Sender
  623. is the :class:`celery.beat.Service` instance.
  624. * Redis result backend: Removed deprecated settings `REDIS_TIMEOUT` and
  625. `REDIS_CONNECT_RETRY`.
  626. * CentOS init-script for :program:`celery worker` now available in `extra/centos`.
  627. * Now depends on :pypi:`pyparsing` version 1.5.0 or higher.
  628. There have been reported issues using Celery with :pypi:`pyparsing` 1.4.x,
  629. so please upgrade to the latest version.
  630. * Lots of new unit tests written, now with a total coverage of 95%.
  631. .. _v220-fixes:
  632. Fixes
  633. -----
  634. * `celeryev` Curses Monitor: Improved resize handling and UI layout
  635. (Issue #274 + Issue #276)
  636. * AMQP Backend: Exceptions occurring while sending task results are now
  637. propagated instead of silenced.
  638. the worker will then show the full traceback of these errors in the log.
  639. * AMQP Backend: No longer deletes the result queue after successful
  640. poll, as this should be handled by the
  641. :setting:`CELERY_AMQP_TASK_RESULT_EXPIRES` setting instead.
  642. * AMQP Backend: Now ensures queues are declared before polling results.
  643. * Windows: worker: Show error if running with `-B` option.
  644. Running ``celerybeat`` embedded is known not to work on Windows, so
  645. users are encouraged to run ``celerybeat`` as a separate service instead.
  646. * Windows: Utilities no longer output ANSI color codes on Windows
  647. * ``camqadm``: Now properly handles :kbd:`Control-c` by simply exiting instead
  648. of showing confusing traceback.
  649. * Windows: All tests are now passing on Windows.
  650. * Remove bin/ directory, and `scripts` section from :file:`setup.py`.
  651. This means we now rely completely on setuptools entry-points.
  652. .. _v220-experimental:
  653. Experimental
  654. ------------
  655. * Jython: worker now runs on Jython using the threaded pool.
  656. All tests pass, but there may still be bugs lurking around the corners.
  657. * PyPy: worker now runs on PyPy.
  658. It runs without any pool, so to get parallel execution you must start
  659. multiple instances (e.g., using :program:`multi`).
  660. Sadly an initial benchmark seems to show a 30% performance decrease on
  661. ``pypy-1.4.1`` + JIT. We would like to find out why this is, so stay tuned.
  662. * :class:`PublisherPool`: Experimental pool of task publishers and
  663. connections to be used with the `retry` argument to `apply_async`.
  664. The example code below will re-use connections and channels, and
  665. retry sending of the task message if the connection is lost.
  666. .. code-block:: python
  667. from celery import current_app
  668. # Global pool
  669. pool = current_app().amqp.PublisherPool(limit=10)
  670. def my_view(request):
  671. with pool.acquire() as publisher:
  672. add.apply_async((2, 2), publisher=publisher, retry=True)