changelog-2.0.rst 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084
  1. .. _changelog-2.0:
  2. ===============================
  3. Change history for Celery 2.0
  4. ===============================
  5. .. contents::
  6. :local:
  7. .. _version-2.0.3:
  8. 2.0.3
  9. =====
  10. :release-date: 2010-08-27 12:00 P.M CEST
  11. :release-by: Ask Solem
  12. .. _v203-fixes:
  13. Fixes
  14. -----
  15. * Worker: Properly handle connection errors happening while
  16. closing consumers.
  17. * Worker: Events are now buffered if the connection is down,
  18. then sent when the connection is re-established.
  19. * No longer depends on the :pypi:`mailer` package.
  20. This package had a name space collision with `django-mailer`,
  21. so its functionality was replaced.
  22. * Redis result backend: Documentation typos: Redis doesn't have
  23. database names, but database numbers. The default database is now 0.
  24. * :class:`~celery.task.control.inspect`:
  25. `registered_tasks` was requesting an invalid command because of a typo.
  26. See issue #170.
  27. * :setting:`CELERY_ROUTES`: Values defined in the route should now have
  28. precedence over values defined in :setting:`CELERY_QUEUES` when merging
  29. the two.
  30. With the follow settings:
  31. .. code-block:: python
  32. CELERY_QUEUES = {'cpubound': {'exchange': 'cpubound',
  33. 'routing_key': 'cpubound'}}
  34. CELERY_ROUTES = {'tasks.add': {'queue': 'cpubound',
  35. 'routing_key': 'tasks.add',
  36. 'serializer': 'json'}}
  37. The final routing options for `tasks.add` will become:
  38. .. code-block:: python
  39. {'exchange': 'cpubound',
  40. 'routing_key': 'tasks.add',
  41. 'serializer': 'json'}
  42. This was not the case before: the values
  43. in :setting:`CELERY_QUEUES` would take precedence.
  44. * Worker crashed if the value of :setting:`CELERY_TASK_ERROR_WHITELIST` was
  45. not an iterable
  46. * :func:`~celery.execute.apply`: Make sure `kwargs['task_id']` is
  47. always set.
  48. * `AsyncResult.traceback`: Now returns :const:`None`, instead of raising
  49. :exc:`KeyError` if traceback is missing.
  50. * :class:`~celery.task.control.inspect`: Replies did not work correctly
  51. if no destination was specified.
  52. * Can now store result/meta-data for custom states.
  53. * Worker: A warning is now emitted if the sending of task error
  54. emails fails.
  55. * ``celeryev``: Curses monitor no longer crashes if the terminal window
  56. is resized.
  57. See issue #160.
  58. * Worker: On macOS it is not possible to run `os.exec*` in a process
  59. that is threaded.
  60. This breaks the SIGHUP restart handler,
  61. and is now disabled on macOS, emitting a warning instead.
  62. See issue #152.
  63. * :mod:`celery.execute.trace`: Properly handle `raise(str)`,
  64. which is still allowed in Python 2.4.
  65. See issue #175.
  66. * Using urllib2 in a periodic task on macOS crashed because
  67. of the proxy auto detection used in macOS.
  68. This is now fixed by using a workaround.
  69. See issue #143.
  70. * Debian init-scripts: Commands should not run in a sub shell
  71. See issue #163.
  72. * Debian init-scripts: Use the absolute path of ``celeryd`` program to allow stat
  73. See issue #162.
  74. .. _v203-documentation:
  75. Documentation
  76. -------------
  77. * getting-started/broker-installation: Fixed typo
  78. `set_permissions ""` -> `set_permissions ".*"`.
  79. * Tasks User Guide: Added section on database transactions.
  80. See issue #169.
  81. * Routing User Guide: Fixed typo `"feed": -> {"queue": "feeds"}`.
  82. See issue #169.
  83. * Documented the default values for the :setting:`CELERYD_CONCURRENCY`
  84. and :setting:`CELERYD_PREFETCH_MULTIPLIER` settings.
  85. * Tasks User Guide: Fixed typos in the subtask example
  86. * celery.signals: Documented worker_process_init.
  87. * Daemonization cookbook: Need to export DJANGO_SETTINGS_MODULE in
  88. `/etc/default/celeryd`.
  89. * Added some more FAQs from stack overflow
  90. * Daemonization cookbook: Fixed typo `CELERYD_LOGFILE/CELERYD_PIDFILE`
  91. to `CELERYD_LOG_FILE` / `CELERYD_PID_FILE`
  92. Also added troubleshooting section for the init-scripts.
  93. .. _version-2.0.2:
  94. 2.0.2
  95. =====
  96. :release-date: 2010-07-22 11:31 A.M CEST
  97. :release-by: Ask Solem
  98. * Routes: When using the dict route syntax, the exchange for a task
  99. could disappear making the task unroutable.
  100. See issue #158.
  101. * Test suite now passing on Python 2.4
  102. * No longer have to type `PYTHONPATH=.` to use ``celeryconfig`` in the current
  103. directory.
  104. This is accomplished by the default loader ensuring that the current
  105. directory is in `sys.path` when loading the config module.
  106. `sys.path` is reset to its original state after loading.
  107. Adding the current working directory to `sys.path` without the user
  108. knowing may be a security issue, as this means someone can drop a Python module in the users
  109. directory that executes arbitrary commands. This was the original reason
  110. not to do this, but if done *only when loading the config module*, this
  111. means that the behavior will only apply to the modules imported in the
  112. config module, which I think is a good compromise (certainly better than
  113. just explicitly setting `PYTHONPATH=.` anyway)
  114. * Experimental Cassandra backend added.
  115. * Worker: SIGHUP handler accidentally propagated to worker pool processes.
  116. In combination with :sha:`7a7c44e39344789f11b5346e9cc8340f5fe4846c`
  117. this would make each child process start a new worker instance when
  118. the terminal window was closed :/
  119. * Worker: Do not install SIGHUP handler if running from a terminal.
  120. This fixes the problem where the worker is launched in the background
  121. when closing the terminal.
  122. * Worker: Now joins threads at shutdown.
  123. See issue #152.
  124. * Test tear down: Don't use `atexit` but nose's `teardown()` functionality
  125. instead.
  126. See issue #154.
  127. * Debian worker init-script: Stop now works correctly.
  128. * Task logger: `warn` method added (synonym for `warning`)
  129. * Can now define a white list of errors to send error emails for.
  130. Example:
  131. .. code-block:: python
  132. CELERY_TASK_ERROR_WHITELIST = ('myapp.MalformedInputError',)
  133. See issue #153.
  134. * Worker: Now handles overflow exceptions in `time.mktime` while parsing
  135. the ETA field.
  136. * LoggerWrapper: Try to detect loggers logging back to stderr/stdout making
  137. an infinite loop.
  138. * Added :class:`celery.task.control.inspect`: Inspects a running worker.
  139. Examples:
  140. .. code-block:: pycon
  141. # Inspect a single worker
  142. >>> i = inspect('myworker.example.com')
  143. # Inspect several workers
  144. >>> i = inspect(['myworker.example.com', 'myworker2.example.com'])
  145. # Inspect all workers consuming on this vhost.
  146. >>> i = inspect()
  147. ### Methods
  148. # Get currently executing tasks
  149. >>> i.active()
  150. # Get currently reserved tasks
  151. >>> i.reserved()
  152. # Get the current eta schedule
  153. >>> i.scheduled()
  154. # Worker statistics and info
  155. >>> i.stats()
  156. # List of currently revoked tasks
  157. >>> i.revoked()
  158. # List of registered tasks
  159. >>> i.registered_tasks()
  160. * Remote control commands `dump_active`/`dump_reserved`/`dump_schedule`
  161. now replies with detailed task requests.
  162. Containing the original arguments and fields of the task requested.
  163. In addition the remote control command `set_loglevel` has been added,
  164. this only changes the log level for the main process.
  165. * Worker control command execution now catches errors and returns their
  166. string representation in the reply.
  167. * Functional test suite added
  168. :mod:`celery.tests.functional.case` contains utilities to start
  169. and stop an embedded worker process, for use in functional testing.
  170. .. _version-2.0.1:
  171. 2.0.1
  172. =====
  173. :release-date: 2010-07-09 03:02 P.M CEST
  174. :release-by: Ask Solem
  175. * multiprocessing.pool: Now handles encoding errors, so that pickling errors
  176. doesn't crash the worker processes.
  177. * The remote control command replies was not working with RabbitMQ 1.8.0's
  178. stricter equivalence checks.
  179. If you've already hit this problem you may have to delete the
  180. declaration:
  181. .. code-block:: console
  182. $ camqadm exchange.delete celerycrq
  183. or:
  184. .. code-block:: console
  185. $ python manage.py camqadm exchange.delete celerycrq
  186. * A bug sneaked in the ETA scheduler that made it only able to execute
  187. one task per second(!)
  188. The scheduler sleeps between iterations so it doesn't consume too much CPU.
  189. It keeps a list of the scheduled items sorted by time, at each iteration
  190. it sleeps for the remaining time of the item with the nearest deadline.
  191. If there are no eta tasks it will sleep for a minimum amount of time, one
  192. second by default.
  193. A bug sneaked in here, making it sleep for one second for every task
  194. that was scheduled. This has been fixed, so now it should move
  195. tasks like hot knife through butter.
  196. In addition a new setting has been added to control the minimum sleep
  197. interval; :setting:`CELERYD_ETA_SCHEDULER_PRECISION`. A good
  198. value for this would be a float between 0 and 1, depending
  199. on the needed precision. A value of 0.8 means that when the ETA of a task
  200. is met, it will take at most 0.8 seconds for the task to be moved to the
  201. ready queue.
  202. * Pool: Supervisor did not release the semaphore.
  203. This would lead to a deadlock if all workers terminated prematurely.
  204. * Added Python version trove classifiers: 2.4, 2.5, 2.6 and 2.7
  205. * Tests now passing on Python 2.7.
  206. * Task.__reduce__: Tasks created using the task decorator can now be pickled.
  207. * :file:`setup.py`: :pypi:`nose` added to `tests_require`.
  208. * Pickle should now work with SQLAlchemy 0.5.x
  209. * New homepage design by Jan Henrik Helmers: http://celeryproject.org
  210. * New Sphinx theme by Armin Ronacher: http://docs.celeryproject.org/
  211. * Fixed "pending_xref" errors shown in the HTML rendering of the
  212. documentation. Apparently this was caused by new changes in Sphinx 1.0b2.
  213. * Router classes in :setting:`CELERY_ROUTES` are now imported lazily.
  214. Importing a router class in a module that also loads the Celery
  215. environment would cause a circular dependency. This is solved
  216. by importing it when needed after the environment is set up.
  217. * :setting:`CELERY_ROUTES` was broken if set to a single dict.
  218. This example in the docs should now work again:
  219. .. code-block:: python
  220. CELERY_ROUTES = {'feed.tasks.import_feed': 'feeds'}
  221. * `CREATE_MISSING_QUEUES` was not honored by apply_async.
  222. * New remote control command: `stats`
  223. Dumps information about the worker, like pool process ids, and
  224. total number of tasks executed by type.
  225. Example reply:
  226. .. code-block:: python
  227. [{'worker.local':
  228. 'total': {'tasks.sleeptask': 6},
  229. 'pool': {'timeouts': [None, None],
  230. 'processes': [60376, 60377],
  231. 'max-concurrency': 2,
  232. 'max-tasks-per-child': None,
  233. 'put-guarded-by-semaphore': True}}]
  234. * New remote control command: `dump_active`
  235. Gives a list of tasks currently being executed by the worker.
  236. By default arguments are passed through repr in case there
  237. are arguments that is not JSON encodable. If you know
  238. the arguments are JSON safe, you can pass the argument `safe=True`.
  239. Example reply:
  240. .. code-block:: pycon
  241. >>> broadcast('dump_active', arguments={'safe': False}, reply=True)
  242. [{'worker.local': [
  243. {'args': '(1,)',
  244. 'time_start': 1278580542.6300001,
  245. 'name': 'tasks.sleeptask',
  246. 'delivery_info': {
  247. 'consumer_tag': '30',
  248. 'routing_key': 'celery',
  249. 'exchange': 'celery'},
  250. 'hostname': 'casper.local',
  251. 'acknowledged': True,
  252. 'kwargs': '{}',
  253. 'id': '802e93e9-e470-47ed-b913-06de8510aca2',
  254. }
  255. ]}]
  256. * Added experimental support for persistent revokes.
  257. Use the `-S|--statedb` argument to the worker to enable it:
  258. .. code-block:: console
  259. $ celeryd --statedb=/var/run/celeryd
  260. This will use the file: `/var/run/celeryd.db`,
  261. as the `shelve` module automatically adds the `.db` suffix.
  262. .. _version-2.0.0:
  263. 2.0.0
  264. =====
  265. :release-date: 2010-07-02 02:30 P.M CEST
  266. :release-by: Ask Solem
  267. Foreword
  268. --------
  269. Celery 2.0 contains backward incompatible changes, the most important
  270. being that the Django dependency has been removed so Celery no longer
  271. supports Django out of the box, but instead as an add-on package
  272. called `django-celery`_.
  273. We're very sorry for breaking backwards compatibility, but there's
  274. also many new and exciting features to make up for the time you lose
  275. upgrading, so be sure to read the :ref:`News <v200-news>` section.
  276. Quite a lot of potential users have been upset about the Django dependency,
  277. so maybe this is a chance to get wider adoption by the Python community as
  278. well.
  279. Big thanks to all contributors, testers and users!
  280. .. _v200-django-upgrade:
  281. Upgrading for Django-users
  282. --------------------------
  283. Django integration has been moved to a separate package: `django-celery`_.
  284. * To upgrade you need to install the `django-celery`_ module and change:
  285. .. code-block:: python
  286. INSTALLED_APPS = 'celery'
  287. to:
  288. .. code-block:: python
  289. INSTALLED_APPS = 'djcelery'
  290. * If you use `mod_wsgi` you need to add the following line to your `.wsgi`
  291. file:
  292. .. code-block:: python
  293. import os
  294. os.environ['CELERY_LOADER'] = 'django'
  295. * The following modules has been moved to `django-celery`_:
  296. ===================================== =====================================
  297. **Module name** **Replace with**
  298. ===================================== =====================================
  299. `celery.models` `djcelery.models`
  300. `celery.managers` `djcelery.managers`
  301. `celery.views` `djcelery.views`
  302. `celery.urls` `djcelery.urls`
  303. `celery.management` `djcelery.management`
  304. `celery.loaders.djangoapp` `djcelery.loaders`
  305. `celery.backends.database` `djcelery.backends.database`
  306. `celery.backends.cache` `djcelery.backends.cache`
  307. ===================================== =====================================
  308. Importing :mod:`djcelery` will automatically setup Celery to use Django loader.
  309. loader. It does this by setting the :envvar:`CELERY_LOADER` environment variable to
  310. `"django"` (it won't change it if a loader is already set.)
  311. When the Django loader is used, the "database" and "cache" result backend
  312. aliases will point to the :mod:`djcelery` backends instead of the built-in backends,
  313. and configuration will be read from the Django settings.
  314. .. _`django-celery`: http://pypi.python.org/pypi/django-celery
  315. .. _v200-upgrade:
  316. Upgrading for others
  317. --------------------
  318. .. _v200-upgrade-database:
  319. Database result backend
  320. ~~~~~~~~~~~~~~~~~~~~~~~
  321. The database result backend is now using `SQLAlchemy`_ instead of the
  322. Django ORM, see `Supported Databases`_ for a table of supported databases.
  323. The `DATABASE_*` settings has been replaced by a single setting:
  324. :setting:`CELERY_RESULT_DBURI`. The value here should be an
  325. `SQLAlchemy Connection String`_, some examples include:
  326. .. code-block:: python
  327. # sqlite (filename)
  328. CELERY_RESULT_DBURI = 'sqlite:///celerydb.sqlite'
  329. # mysql
  330. CELERY_RESULT_DBURI = 'mysql://scott:tiger@localhost/foo'
  331. # postgresql
  332. CELERY_RESULT_DBURI = 'postgresql://scott:tiger@localhost/mydatabase'
  333. # oracle
  334. CELERY_RESULT_DBURI = 'oracle://scott:tiger@127.0.0.1:1521/sidname'
  335. See `SQLAlchemy Connection Strings`_ for more information about connection
  336. strings.
  337. To specify additional SQLAlchemy database engine options you can use
  338. the :setting:`CELERY_RESULT_ENGINE_OPTIONS` setting:
  339. .. code-block:: python
  340. # echo enables verbose logging from SQLAlchemy.
  341. CELERY_RESULT_ENGINE_OPTIONS = {'echo': True}
  342. .. _`SQLAlchemy`:
  343. http://www.sqlalchemy.org
  344. .. _`Supported Databases`:
  345. http://www.sqlalchemy.org/docs/core/engines.html#supported-databases
  346. .. _`SQLAlchemy Connection String`:
  347. http://www.sqlalchemy.org/docs/core/engines.html#database-urls
  348. .. _`SQLAlchemy Connection Strings`:
  349. http://www.sqlalchemy.org/docs/core/engines.html#database-urls
  350. .. _v200-upgrade-cache:
  351. Cache result backend
  352. ~~~~~~~~~~~~~~~~~~~~
  353. The cache result backend is no longer using the Django cache framework,
  354. but it supports mostly the same configuration syntax:
  355. .. code-block:: python
  356. CELERY_CACHE_BACKEND = 'memcached://A.example.com:11211;B.example.com'
  357. To use the cache backend you must either have the `pylibmc`_ or
  358. `python-memcached`_ library installed, of which the former is regarded
  359. as the best choice.
  360. .. _`pylibmc`: http://pypi.python.org/pypi/pylibmc
  361. .. _`python-memcached`: http://pypi.python.org/pypi/python-memcached
  362. The support backend types are `memcached://` and `memory://`,
  363. we haven't felt the need to support any of the other backends
  364. provided by Django.
  365. .. _v200-incompatible:
  366. Backward incompatible changes
  367. -----------------------------
  368. * Default (python) loader now prints warning on missing `celeryconfig.py`
  369. instead of raising :exc:`ImportError`.
  370. The worker raises :exc:`~@ImproperlyConfigured` if the configuration
  371. is not set up. This makes it possible to use `--help` etc., without having a
  372. working configuration.
  373. Also this makes it possible to use the client side of celery without being
  374. configured:
  375. .. code-block:: pycon
  376. >>> from carrot.connection import BrokerConnection
  377. >>> conn = BrokerConnection('localhost', 'guest', 'guest', '/')
  378. >>> from celery.execute import send_task
  379. >>> r = send_task('celery.ping', args=(), kwargs={}, connection=conn)
  380. >>> from celery.backends.amqp import AMQPBackend
  381. >>> r.backend = AMQPBackend(connection=conn)
  382. >>> r.get()
  383. 'pong'
  384. * The following deprecated settings has been removed (as scheduled by
  385. the :ref:`deprecation-timeline`):
  386. ===================================== =====================================
  387. **Setting name** **Replace with**
  388. ===================================== =====================================
  389. `CELERY_AMQP_CONSUMER_QUEUES` `CELERY_QUEUES`
  390. `CELERY_AMQP_EXCHANGE` `CELERY_DEFAULT_EXCHANGE`
  391. `CELERY_AMQP_EXCHANGE_TYPE` `CELERY_DEFAULT_EXCHANGE_TYPE`
  392. `CELERY_AMQP_CONSUMER_ROUTING_KEY` `CELERY_QUEUES`
  393. `CELERY_AMQP_PUBLISHER_ROUTING_KEY` `CELERY_DEFAULT_ROUTING_KEY`
  394. ===================================== =====================================
  395. * The `celery.task.rest` module has been removed, use `celery.task.http`
  396. instead (as scheduled by the :ref:`deprecation-timeline`).
  397. * It's no longer allowed to skip the class name in loader names.
  398. (as scheduled by the :ref:`deprecation-timeline`):
  399. Assuming the implicit `Loader` class name is no longer supported,
  400. if you use e.g.:
  401. .. code-block:: python
  402. CELERY_LOADER = 'myapp.loaders'
  403. You need to include the loader class name, like this:
  404. .. code-block:: python
  405. CELERY_LOADER = 'myapp.loaders.Loader'
  406. * :setting:`CELERY_TASK_RESULT_EXPIRES` now defaults to 1 day.
  407. Previous default setting was to expire in 5 days.
  408. * AMQP backend: Don't use different values for `auto_delete`.
  409. This bug became visible with RabbitMQ 1.8.0, which no longer
  410. allows conflicting declarations for the auto_delete and durable settings.
  411. If you've already used celery with this backend chances are you
  412. have to delete the previous declaration:
  413. .. code-block:: console
  414. $ camqadm exchange.delete celeryresults
  415. * Now uses pickle instead of cPickle on Python versions <= 2.5
  416. cPickle is broken in Python <= 2.5.
  417. It unsafely and incorrectly uses relative instead of absolute imports,
  418. so e.g.:
  419. .. code-block:: python
  420. exceptions.KeyError
  421. becomes:
  422. .. code-block:: python
  423. celery.exceptions.KeyError
  424. Your best choice is to upgrade to Python 2.6,
  425. as while the pure pickle version has worse performance,
  426. it is the only safe option for older Python versions.
  427. .. _v200-news:
  428. News
  429. ----
  430. * **celeryev**: Curses Celery Monitor and Event Viewer.
  431. This is a simple monitor allowing you to see what tasks are
  432. executing in real-time and investigate tracebacks and results of ready
  433. tasks. It also enables you to set new rate limits and revoke tasks.
  434. Screenshot:
  435. .. figure:: ../images/celeryevshotsm.jpg
  436. If you run `celeryev` with the `-d` switch it will act as an event
  437. dumper, simply dumping the events it receives to standard out:
  438. .. code-block:: console
  439. $ celeryev -d
  440. -> celeryev: starting capture...
  441. casper.local [2010-06-04 10:42:07.020000] heartbeat
  442. casper.local [2010-06-04 10:42:14.750000] task received:
  443. tasks.add(61a68756-27f4-4879-b816-3cf815672b0e) args=[2, 2] kwargs={}
  444. eta=2010-06-04T10:42:16.669290, retries=0
  445. casper.local [2010-06-04 10:42:17.230000] task started
  446. tasks.add(61a68756-27f4-4879-b816-3cf815672b0e) args=[2, 2] kwargs={}
  447. casper.local [2010-06-04 10:42:17.960000] task succeeded:
  448. tasks.add(61a68756-27f4-4879-b816-3cf815672b0e)
  449. args=[2, 2] kwargs={} result=4, runtime=0.782663106918
  450. The fields here are, in order: *sender hostname*, *timestamp*, *event type* and
  451. *additional event fields*.
  452. * AMQP result backend: Now supports `.ready()`, `.successful()`,
  453. `.result`, `.status`, and even responds to changes in task state
  454. * New user guides:
  455. * :ref:`guide-workers`
  456. * :ref:`guide-canvas`
  457. * :ref:`guide-routing`
  458. * Worker: Standard out/error is now being redirected to the log file.
  459. * :pypi:`billiard` has been moved back to the celery repository.
  460. ===================================== =====================================
  461. **Module name** **celery equivalent**
  462. ===================================== =====================================
  463. `billiard.pool` `celery.concurrency.processes.pool`
  464. `billiard.serialization` `celery.serialization`
  465. `billiard.utils.functional` `celery.utils.functional`
  466. ===================================== =====================================
  467. The :pypi:`billiard` distribution may be maintained, depending on interest.
  468. * now depends on :pypi:`carrot` >= 0.10.5
  469. * now depends on :pypi:`pyparsing`
  470. * Worker: Added `--purge` as an alias to `--discard`.
  471. * Worker: :kbd:`Control-c` (SIGINT) once does warm shutdown,
  472. hitting :kbd:`Control-c` twice forces termination.
  473. * Added support for using complex Crontab-expressions in periodic tasks. For
  474. example, you can now use:
  475. .. code-block:: pycon
  476. >>> crontab(minute='*/15')
  477. or even:
  478. .. code-block:: pycon
  479. >>> crontab(minute='*/30', hour='8-17,1-2', day_of_week='thu-fri')
  480. See :ref:`guide-beat`.
  481. * Worker: Now waits for available pool processes before applying new
  482. tasks to the pool.
  483. This means it doesn't have to wait for dozens of tasks to finish at shutdown
  484. because it has applied prefetched tasks without having any pool
  485. processes available to immediately accept them.
  486. See issue #122.
  487. * New built-in way to do task callbacks using
  488. :class:`~celery.subtask`.
  489. See :ref:`guide-canvas` for more information.
  490. * TaskSets can now contain several types of tasks.
  491. :class:`~celery.task.sets.TaskSet` has been refactored to use
  492. a new syntax, please see :ref:`guide-canvas` for more information.
  493. The previous syntax is still supported, but will be deprecated in
  494. version 1.4.
  495. * TaskSet failed() result was incorrect.
  496. See issue #132.
  497. * Now creates different loggers per task class.
  498. See issue #129.
  499. * Missing queue definitions are now created automatically.
  500. You can disable this using the :setting:`CELERY_CREATE_MISSING_QUEUES`
  501. setting.
  502. The missing queues are created with the following options:
  503. .. code-block:: python
  504. CELERY_QUEUES[name] = {'exchange': name,
  505. 'exchange_type': 'direct',
  506. 'routing_key': 'name}
  507. This feature is added for easily setting up routing using the `-Q`
  508. option to the worker:
  509. .. code-block:: console
  510. $ celeryd -Q video, image
  511. See the new routing section of the User Guide for more information:
  512. :ref:`guide-routing`.
  513. * New Task option: `Task.queue`
  514. If set, message options will be taken from the corresponding entry
  515. in :setting:`CELERY_QUEUES`. `exchange`, `exchange_type` and `routing_key`
  516. will be ignored
  517. * Added support for task soft and hard time limits.
  518. New settings added:
  519. * :setting:`CELERYD_TASK_TIME_LIMIT`
  520. Hard time limit. The worker processing the task will be killed and
  521. replaced with a new one when this is exceeded.
  522. * :setting:`CELERYD_TASK_SOFT_TIME_LIMIT`
  523. Soft time limit. The :exc:`~@SoftTimeLimitExceeded`
  524. exception will be raised when this is exceeded. The task can catch
  525. this to e.g. clean up before the hard time limit comes.
  526. New command-line arguments to ``celeryd`` added:
  527. `--time-limit` and `--soft-time-limit`.
  528. What's left?
  529. This won't work on platforms not supporting signals (and specifically
  530. the `SIGUSR1` signal) yet. So an alternative the ability to disable
  531. the feature all together on nonconforming platforms must be implemented.
  532. Also when the hard time limit is exceeded, the task result should
  533. be a `TimeLimitExceeded` exception.
  534. * Test suite is now passing without a running broker, using the carrot
  535. in-memory backend.
  536. * Log output is now available in colors.
  537. ===================================== =====================================
  538. **Log level** **Color**
  539. ===================================== =====================================
  540. `DEBUG` Blue
  541. `WARNING` Yellow
  542. `CRITICAL` Magenta
  543. `ERROR` Red
  544. ===================================== =====================================
  545. This is only enabled when the log output is a tty.
  546. You can explicitly enable/disable this feature using the
  547. :setting:`CELERYD_LOG_COLOR` setting.
  548. * Added support for task router classes (like the django multi-db routers)
  549. * New setting: :setting:`CELERY_ROUTES`
  550. This is a single, or a list of routers to traverse when
  551. sending tasks. Dictionaries in this list converts to a
  552. :class:`celery.routes.MapRoute` instance.
  553. Examples:
  554. >>> CELERY_ROUTES = {'celery.ping': 'default',
  555. 'mytasks.add': 'cpu-bound',
  556. 'video.encode': {
  557. 'queue': 'video',
  558. 'exchange': 'media'
  559. 'routing_key': 'media.video.encode'}}
  560. >>> CELERY_ROUTES = ('myapp.tasks.Router',
  561. {'celery.ping': 'default})
  562. Where `myapp.tasks.Router` could be:
  563. .. code-block:: python
  564. class Router(object):
  565. def route_for_task(self, task, args=None, kwargs=None):
  566. if task == 'celery.ping':
  567. return 'default'
  568. route_for_task may return a string or a dict. A string then means
  569. it's a queue name in :setting:`CELERY_QUEUES`, a dict means it's a custom route.
  570. When sending tasks, the routers are consulted in order. The first
  571. router that doesn't return `None` is the route to use. The message options
  572. is then merged with the found route settings, where the routers settings
  573. have priority.
  574. Example if :func:`~celery.execute.apply_async` has these arguments:
  575. .. code-block:: pycon
  576. >>> Task.apply_async(immediate=False, exchange='video',
  577. ... routing_key='video.compress')
  578. and a router returns:
  579. .. code-block:: python
  580. {'immediate': True,
  581. 'exchange': 'urgent'}
  582. the final message options will be:
  583. .. code-block:: pycon
  584. >>> task.apply_async(
  585. ... immediate=True,
  586. ... exchange='urgent',
  587. ... routing_key='video.compress',
  588. ... )
  589. (and any default message options defined in the
  590. :class:`~celery.task.base.Task` class)
  591. * New Task handler called after the task returns:
  592. :meth:`~celery.task.base.Task.after_return`.
  593. * :class:`~billiard.einfo.ExceptionInfo` now passed to
  594. :meth:`~celery.task.base.Task.on_retry`/
  595. :meth:`~celery.task.base.Task.on_failure` as ``einfo`` keyword argument.
  596. * Worker: Added :setting:`CELERYD_MAX_TASKS_PER_CHILD` /
  597. :option:`celery worker --maxtasksperchild`
  598. Defines the maximum number of tasks a pool worker can process before
  599. the process is terminated and replaced by a new one.
  600. * Revoked tasks now marked with state :state:`REVOKED`, and `result.get()`
  601. will now raise :exc:`~@TaskRevokedError`.
  602. * :func:`celery.task.control.ping` now works as expected.
  603. * `apply(throw=True)` / :setting:`CELERY_EAGER_PROPAGATES_EXCEPTIONS`:
  604. Makes eager execution re-raise task errors.
  605. * New signal: :signal:`~celery.signals.worker_process_init`: Sent inside the
  606. pool worker process at init.
  607. * Worker: :option:`celery worker -Q` option: Ability to specify list of queues
  608. to use, disabling other configured queues.
  609. For example, if :setting:`CELERY_QUEUES` defines four
  610. queues: `image`, `video`, `data` and `default`, the following
  611. command would make the worker only consume from the `image` and `video`
  612. queues:
  613. .. code-block:: console
  614. $ celeryd -Q image,video
  615. * Worker: New return value for the `revoke` control command:
  616. Now returns:
  617. .. code-block:: python
  618. {'ok': 'task $id revoked'}
  619. instead of :const:`True`.
  620. * Worker: Can now enable/disable events using remote control
  621. Example usage:
  622. >>> from celery.task.control import broadcast
  623. >>> broadcast('enable_events')
  624. >>> broadcast('disable_events')
  625. * Removed top-level tests directory. Test config now in celery.tests.config
  626. This means running the unit tests doesn't require any special setup.
  627. `celery/tests/__init__` now configures the :envvar:`CELERY_CONFIG_MODULE`
  628. and :envvar:`CELERY_LOADER` environment variables, so when `nosetests`
  629. imports that, the unit test environment is all set up.
  630. Before you run the tests you need to install the test requirements:
  631. .. code-block:: console
  632. $ pip install -r requirements/test.txt
  633. Running all tests:
  634. .. code-block:: console
  635. $ nosetests
  636. Specifying the tests to run:
  637. .. code-block:: console
  638. $ nosetests celery.tests.test_task
  639. Producing HTML coverage:
  640. .. code-block:: console
  641. $ nosetests --with-coverage3
  642. The coverage output is then located in `celery/tests/cover/index.html`.
  643. * Worker: New option `--version`: Dump version info and exit.
  644. * :mod:`celeryd-multi <celeryd.bin.multi>`: Tool for shell scripts
  645. to start multiple workers.
  646. Some examples:
  647. - Advanced example with 10 workers:
  648. * Three of the workers processes the images and video queue
  649. * Two of the workers processes the data queue with loglevel DEBUG
  650. * the rest processes the default' queue.
  651. .. code-block:: console
  652. $ celeryd-multi start 10 -l INFO -Q:1-3 images,video -Q:4,5:data -Q default -L:4,5 DEBUG
  653. - Get commands to start 10 workers, with 3 processes each
  654. .. code-block:: console
  655. $ celeryd-multi start 3 -c 3
  656. celeryd -n celeryd1.myhost -c 3
  657. celeryd -n celeryd2.myhost -c 3
  658. celeryd -n celeryd3.myhost -c 3
  659. - Start 3 named workers
  660. .. code-block:: console
  661. $ celeryd-multi start image video data -c 3
  662. celeryd -n image.myhost -c 3
  663. celeryd -n video.myhost -c 3
  664. celeryd -n data.myhost -c 3
  665. - Specify custom hostname
  666. .. code-block:: console
  667. $ celeryd-multi start 2 -n worker.example.com -c 3
  668. celeryd -n celeryd1.worker.example.com -c 3
  669. celeryd -n celeryd2.worker.example.com -c 3
  670. Additional options are added to each ``celeryd``,
  671. but you can also modify the options for ranges of or single workers
  672. - 3 workers: Two with 3 processes, and one with 10 processes.
  673. .. code-block:: console
  674. $ celeryd-multi start 3 -c 3 -c:1 10
  675. celeryd -n celeryd1.myhost -c 10
  676. celeryd -n celeryd2.myhost -c 3
  677. celeryd -n celeryd3.myhost -c 3
  678. - Can also specify options for named workers
  679. .. code-block:: console
  680. $ celeryd-multi start image video data -c 3 -c:image 10
  681. celeryd -n image.myhost -c 10
  682. celeryd -n video.myhost -c 3
  683. celeryd -n data.myhost -c 3
  684. - Ranges and lists of workers in options is also allowed:
  685. (``-c:1-3`` can also be written as ``-c:1,2,3``)
  686. .. code-block:: console
  687. $ celeryd-multi start 5 -c 3 -c:1-3 10
  688. celeryd-multi -n celeryd1.myhost -c 10
  689. celeryd-multi -n celeryd2.myhost -c 10
  690. celeryd-multi -n celeryd3.myhost -c 10
  691. celeryd-multi -n celeryd4.myhost -c 3
  692. celeryd-multi -n celeryd5.myhost -c 3
  693. - Lists also work with named workers:
  694. .. code-block:: console
  695. $ celeryd-multi start foo bar baz xuzzy -c 3 -c:foo,bar,baz 10
  696. celeryd-multi -n foo.myhost -c 10
  697. celeryd-multi -n bar.myhost -c 10
  698. celeryd-multi -n baz.myhost -c 10
  699. celeryd-multi -n xuzzy.myhost -c 3
  700. * The worker now calls the result backends `process_cleanup` method
  701. *after* task execution instead of before.
  702. * AMQP result backend now supports Pika.