README.rst 12 KB

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