changelog-2.2.rst 33 KB

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