changelog-2.0.rst 32 KB

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