README.rst 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454
  1. =================================
  2. celery - Distributed Task Queue
  3. =================================
  4. .. image:: http://cloud.github.com/downloads/celery/celery/celery_128.png
  5. |build-status| |coverage-status|
  6. :Version: 3.2.0a1 (Cipater)
  7. :Web: http://celeryproject.org/
  8. :Download: http://pypi.python.org/pypi/celery/
  9. :Source: http://github.com/celery/celery/
  10. :Keywords: task queue, job queue, asynchronous, async, rabbitmq, amqp, redis,
  11. python, webhooks, queue, distributed
  12. --
  13. What is a Task Queue?
  14. =====================
  15. Task queues are used as a mechanism to distribute work across threads or
  16. machines.
  17. A task queue's input is a unit of work, called a task, dedicated worker
  18. processes then constantly monitor the queue for new work to perform.
  19. Celery communicates via messages, usually using a broker
  20. to mediate between clients and workers. To initiate a task a client puts a
  21. message on the queue, the broker then delivers the message to a worker.
  22. A Celery system can consist of multiple workers and brokers, giving way
  23. to high availability and horizontal scaling.
  24. Celery is a library written in Python, but the protocol can be implemented in
  25. any language. So far there's RCelery_ for the Ruby programming language, and a
  26. `PHP client`, but language interoperability can also be achieved
  27. by using webhooks.
  28. .. _RCelery: https://github.com/leapfrogonline/rcelery
  29. .. _`PHP client`: https://github.com/gjedeer/celery-php
  30. .. _`using webhooks`:
  31. http://docs.celeryproject.org/en/latest/userguide/remote-tasks.html
  32. What do I need?
  33. ===============
  34. Celery version 3.0 runs on,
  35. - Python (2.6, 2.7, 3.3, 3.4)
  36. - PyPy (1.8, 1.9)
  37. - Jython (2.5, 2.7).
  38. This is the last version to support Python 2.5,
  39. and from Celery 3.1, Python 2.6 or later is required.
  40. The last version to support Python 2.4 was Celery series 2.2.
  41. *Celery* is usually used with a message broker to send and receive messages.
  42. The RabbitMQ, Redis transports are feature complete,
  43. but there's also experimental support for a myriad of other solutions, including
  44. using SQLite for local development.
  45. *Celery* can run on a single machine, on multiple machines, or even
  46. across datacenters.
  47. Get Started
  48. ===========
  49. If this is the first time you're trying to use Celery, or you are
  50. new to Celery 3.0 coming from previous versions then you should read our
  51. getting started tutorials:
  52. - `First steps with Celery`_
  53. Tutorial teaching you the bare minimum needed to get started with Celery.
  54. - `Next steps`_
  55. A more complete overview, showing more features.
  56. .. _`First steps with Celery`:
  57. http://docs.celeryproject.org/en/latest/getting-started/first-steps-with-celery.html
  58. .. _`Next steps`:
  59. http://docs.celeryproject.org/en/latest/getting-started/next-steps.html
  60. Celery is...
  61. ==========
  62. - **Simple**
  63. Celery is easy to use and maintain, and does *not need configuration files*.
  64. It has an active, friendly community you can talk to for support,
  65. including a `mailing-list`_ and and an IRC channel.
  66. Here's one of the simplest applications you can make::
  67. from celery import Celery
  68. app = Celery('hello', broker='amqp://guest@localhost//')
  69. @app.task
  70. def hello():
  71. return 'hello world'
  72. - **Highly Available**
  73. Workers and clients will automatically retry in the event
  74. of connection loss or failure, and some brokers support
  75. HA in way of *Master/Master* or *Master/Slave* replication.
  76. - **Fast**
  77. A single Celery process can process millions of tasks a minute,
  78. with sub-millisecond round-trip latency (using RabbitMQ,
  79. py-librabbitmq, and optimized settings).
  80. - **Flexible**
  81. Almost every part of *Celery* can be extended or used on its own,
  82. Custom pool implementations, serializers, compression schemes, logging,
  83. schedulers, consumers, producers, autoscalers, broker transports and much more.
  84. It supports...
  85. ============
  86. - **Message Transports**
  87. - RabbitMQ_, Redis_,
  88. - MongoDB_ (experimental), Amazon SQS (experimental),
  89. - CouchDB_ (experimental), SQLAlchemy_ (experimental),
  90. - Django ORM (experimental), `IronMQ`_
  91. - and more...
  92. - **Concurrency**
  93. - Prefork, Eventlet_, gevent_, threads/single threaded
  94. - **Result Stores**
  95. - AMQP, Redis
  96. - memcached, MongoDB
  97. - SQLAlchemy, Django ORM
  98. - Apache Cassandra, IronCache
  99. - **Serialization**
  100. - *pickle*, *json*, *yaml*, *msgpack*.
  101. - *zlib*, *bzip2* compression.
  102. - Cryptographic message signing.
  103. .. _`Eventlet`: http://eventlet.net/
  104. .. _`gevent`: http://gevent.org/
  105. .. _RabbitMQ: http://rabbitmq.com
  106. .. _Redis: http://redis.io
  107. .. _MongoDB: http://mongodb.org
  108. .. _Beanstalk: http://kr.github.com/beanstalkd
  109. .. _CouchDB: http://couchdb.apache.org
  110. .. _SQLAlchemy: http://sqlalchemy.org
  111. .. _`IronMQ`: http://iron.io
  112. Framework Integration
  113. =====================
  114. Celery is easy to integrate with web frameworks, some of which even have
  115. integration packages:
  116. +--------------------+----------------------------------------------------+
  117. | `Django`_ | not needed |
  118. +--------------------+----------------------------------------------------+
  119. | `Pyramid`_ | `pyramid_celery`_ |
  120. +--------------------+----------------------------------------------------+
  121. | `Pylons`_ | `celery-pylons`_ |
  122. +--------------------+----------------------------------------------------+
  123. | `Flask`_ | not needed |
  124. +--------------------+----------------------------------------------------+
  125. | `web2py`_ | `web2py-celery`_ |
  126. +--------------------+----------------------------------------------------+
  127. | `Tornado`_ | `tornado-celery`_ | `another tornado-celery`_ |
  128. +--------------------+----------------------------------------------------+
  129. The integration packages are not strictly necessary, but they can make
  130. development easier, and sometimes they add important hooks like closing
  131. database connections at ``fork``.
  132. .. _`Django`: http://djangoproject.com/
  133. .. _`Pylons`: http://www.pylonsproject.org/
  134. .. _`Flask`: http://flask.pocoo.org/
  135. .. _`web2py`: http://web2py.com/
  136. .. _`Bottle`: http://bottlepy.org/
  137. .. _`Pyramid`: http://docs.pylonsproject.org/en/latest/docs/pyramid.html
  138. .. _`pyramid_celery`: http://pypi.python.org/pypi/pyramid_celery/
  139. .. _`django-celery`: http://pypi.python.org/pypi/django-celery
  140. .. _`celery-pylons`: http://pypi.python.org/pypi/celery-pylons
  141. .. _`web2py-celery`: http://code.google.com/p/web2py-celery/
  142. .. _`Tornado`: http://www.tornadoweb.org/
  143. .. _`tornado-celery`: http://github.com/mher/tornado-celery/
  144. .. _`another tornado-celery`: https://github.com/mayflaver/tornado-celery
  145. .. _celery-documentation:
  146. Documentation
  147. =============
  148. The `latest documentation`_ with user guides, tutorials and API reference
  149. is hosted at Read The Docs.
  150. .. _`latest documentation`: http://docs.celeryproject.org/en/latest/
  151. .. _celery-installation:
  152. Installation
  153. ============
  154. You can install Celery either via the Python Package Index (PyPI)
  155. or from source.
  156. To install using `pip`,::
  157. $ pip install -U Celery
  158. To install using `easy_install`,::
  159. $ easy_install -U Celery
  160. .. _bundles:
  161. Bundles
  162. -------
  163. Celery also defines a group of bundles that can be used
  164. to install Celery and the dependencies for a given feature.
  165. You can specify these in your requirements or on the ``pip`` comand-line
  166. by using brackets. Multiple bundles can be specified by separating them by
  167. commas.
  168. ::
  169. $ pip install "celery[librabbitmq]"
  170. $ pip install "celery[librabbitmq,redis,auth,msgpack]"
  171. The following bundles are available:
  172. Serializers
  173. ~~~~~~~~~~~
  174. :celery[auth]:
  175. for using the auth serializer.
  176. :celery[msgpack]:
  177. for using the msgpack serializer.
  178. :celery[yaml]:
  179. for using the yaml serializer.
  180. Concurrency
  181. ~~~~~~~~~~~
  182. :celery[eventlet]:
  183. for using the eventlet pool.
  184. :celery[gevent]:
  185. for using the gevent pool.
  186. :celery[threads]:
  187. for using the thread pool.
  188. Transports and Backends
  189. ~~~~~~~~~~~~~~~~~~~~~~~
  190. :celery[librabbitmq]:
  191. for using the librabbitmq C library.
  192. :celery[redis]:
  193. for using Redis as a message transport or as a result backend.
  194. :celery[mongodb]:
  195. for using MongoDB as a message transport (*experimental*),
  196. or as a result backend (*supported*).
  197. :celery[sqs]:
  198. for using Amazon SQS as a message transport (*experimental*).
  199. :celery[memcache]:
  200. for using memcached as a result backend.
  201. :celery[cassandra]:
  202. for using Apache Cassandra as a result backend.
  203. :celery[couchdb]:
  204. for using CouchDB as a message transport (*experimental*).
  205. :celery[couchbase]:
  206. for using CouchBase as a result backend.
  207. :celery[beanstalk]:
  208. for using Beanstalk as a message transport (*experimental*).
  209. :celery[zookeeper]:
  210. for using Zookeeper as a message transport.
  211. :celery[zeromq]:
  212. for using ZeroMQ as a message transport (*experimental*).
  213. :celery[sqlalchemy]:
  214. for using SQLAlchemy as a message transport (*experimental*),
  215. or as a result backend (*supported*).
  216. :celery[pyro]:
  217. for using the Pyro4 message transport (*experimental*).
  218. :celery[slmq]:
  219. for using the SoftLayer Message Queue transport (*experimental*).
  220. .. _celery-installing-from-source:
  221. Downloading and installing from source
  222. --------------------------------------
  223. Download the latest version of Celery from
  224. http://pypi.python.org/pypi/celery/
  225. You can install it by doing the following,::
  226. $ tar xvfz celery-0.0.0.tar.gz
  227. $ cd celery-0.0.0
  228. $ python setup.py build
  229. # python setup.py install
  230. The last command must be executed as a privileged user if
  231. you are not currently using a virtualenv.
  232. .. _celery-installing-from-git:
  233. Using the development version
  234. -----------------------------
  235. With pip
  236. ~~~~~~~~
  237. The Celery development version also requires the development
  238. versions of ``kombu``, ``amqp`` and ``billiard``.
  239. You can install the latest snapshot of these using the following
  240. pip commands::
  241. $ pip install https://github.com/celery/celery/zipball/master#egg=celery
  242. $ pip install https://github.com/celery/billiard/zipball/master#egg=billiard
  243. $ pip install https://github.com/celery/py-amqp/zipball/master#egg=amqp
  244. $ pip install https://github.com/celery/kombu/zipball/master#egg=kombu
  245. With git
  246. ~~~~~~~~
  247. Please the Contributing section.
  248. .. _getting-help:
  249. Getting Help
  250. ============
  251. .. _mailing-list:
  252. Mailing list
  253. ------------
  254. For discussions about the usage, development, and future of celery,
  255. please join the `celery-users`_ mailing list.
  256. .. _`celery-users`: http://groups.google.com/group/celery-users/
  257. .. _irc-channel:
  258. IRC
  259. ---
  260. Come chat with us on IRC. The **#celery** channel is located at the `Freenode`_
  261. network.
  262. .. _`Freenode`: http://freenode.net
  263. .. _bug-tracker:
  264. Bug tracker
  265. ===========
  266. If you have any suggestions, bug reports or annoyances please report them
  267. to our issue tracker at http://github.com/celery/celery/issues/
  268. .. _wiki:
  269. Wiki
  270. ====
  271. http://wiki.github.com/celery/celery/
  272. .. _maintainers:
  273. Maintainers
  274. ===========
  275. - `@ask`_ (primary maintainer)
  276. - `@thedrow`_
  277. - `@chrisgogreen`_
  278. - `@PMickael`_
  279. - `@malinoff`_
  280. - And you? We really need more: https://github.com/celery/celery/issues/2534
  281. .. _`@ask`: http://github.com/ask
  282. .. _`@thedrow`: http://github.com/thedrow
  283. .. _`@chrisgogreen`: http://github.com/chrisgogreen
  284. .. _`@PMickael`: http://github.com/PMickael
  285. .. _`@malinoff`: http://github.com/malinoff
  286. .. _contributing-short:
  287. Contributing
  288. ============
  289. Development of `celery` happens at Github: http://github.com/celery/celery
  290. You are highly encouraged to participate in the development
  291. of `celery`. If you don't like Github (for some reason) you're welcome
  292. to send regular patches.
  293. Be sure to also read the `Contributing to Celery`_ section in the
  294. documentation.
  295. .. _`Contributing to Celery`:
  296. http://docs.celeryproject.org/en/master/contributing.html
  297. .. _license:
  298. License
  299. =======
  300. This software is licensed under the `New BSD License`. See the ``LICENSE``
  301. file in the top distribution directory for the full license text.
  302. .. # vim: syntax=rst expandtab tabstop=4 shiftwidth=4 shiftround
  303. .. image:: https://d2weczhvl823v0.cloudfront.net/celery/celery/trend.png
  304. :alt: Bitdeli badge
  305. :target: https://bitdeli.com/free
  306. .. |build-status| image:: https://travis-ci.org/celery/celery.svg?branch=master
  307. :target: https://travis-ci.org/celery/celery
  308. .. |coverage-status| image:: https://codecov.io/gh/celery/celery/badge.svg
  309. :target: https://codecov.io/gh/celery/celery