README.rst 12 KB

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