README.rst 14 KB

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