README.rst 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. =================================
  2. celery - Distributed Task Queue
  3. =================================
  4. .. image:: http://cloud.github.com/downloads/ask/celery/celery_favicon_128.png
  5. :Version: 2.2.0a1
  6. :Web: http://celeryproject.org/
  7. :Download: http://pypi.python.org/pypi/celery/
  8. :Source: http://github.com/ask/celery/
  9. :Keywords: task queue, job queue, asynchronous, rabbitmq, amqp, redis,
  10. python, webhooks, queue, distributed
  11. --
  12. .. _celery-synopsis:
  13. Celery is an open source asynchronous task queue/job queue based on
  14. distributed message passing. It is focused on real-time operation,
  15. but supports scheduling as well.
  16. The execution units, called tasks, are executed concurrently on one or
  17. more worker nodes. Tasks can execute asynchronously (in the background) or
  18. synchronously (wait until ready).
  19. Celery is already used in production to process millions of tasks a day.
  20. Celery is written in Python, but the protocol can be implemented in any
  21. language. It can also `operate with other languages using webhooks`_.
  22. The recommended message broker is `RabbitMQ`_, but support for `Redis`_ and
  23. databases (`SQLAlchemy`_) is also available.
  24. Celery can be easily used with Django and Pylons using
  25. `django-celery`_ and `celery-pylons`_.
  26. You may also be pleased to know that full Django integration exists,
  27. delivered by the `django-celery`_ package.
  28. .. _`RabbitMQ`: http://www.rabbitmq.com/
  29. .. _`Redis`: http://code.google.com/p/redis/
  30. .. _`SQLAlchemy`: http://www.sqlalchemy.org/
  31. .. _`django-celery`: http://pypi.python.org/pypi/django-celery
  32. .. _`celery-pylons`: http://bitbucket.org/ianschenck/celery-pylons
  33. .. _`operate with other languages using webhooks`:
  34. http://ask.github.com/celery/userguide/remote-tasks.html
  35. .. contents::
  36. :local:
  37. .. _celery-overview:
  38. Overview
  39. ========
  40. This is a high level overview of the architecture.
  41. .. image:: http://cloud.github.com/downloads/ask/celery/Celery-Overview-v4.jpg
  42. The broker pushes tasks to the worker servers.
  43. A worker server is a networked machine running ``celeryd``. This can be one or
  44. more machines depending on the workload.
  45. The result of the task can be stored for later retrieval (called its
  46. "tombstone").
  47. .. _celery-example:
  48. Example
  49. =======
  50. You probably want to see some code by now, so here's an example task
  51. adding two numbers:
  52. ::
  53. from celery.decorators import task
  54. @task
  55. def add(x, y):
  56. return x + y
  57. You can execute the task in the background, or wait for it to finish::
  58. >>> result = add.delay(4, 4)
  59. >>> result.wait() # wait for and return the result
  60. 8
  61. Simple!
  62. .. _celery-features:
  63. Features
  64. ========
  65. +-----------------+----------------------------------------------------+
  66. | Messaging | Supported brokers include `RabbitMQ`_, `Stomp`_, |
  67. | | `Redis`_, and most common SQL databases. |
  68. +-----------------+----------------------------------------------------+
  69. | Robust | Using `RabbitMQ`, celery survives most error |
  70. | | scenarios, and your tasks will never be lost. |
  71. +-----------------+----------------------------------------------------+
  72. | Distributed | Runs on one or more machines. Supports |
  73. | | `clustering`_ when used in combination with |
  74. | | `RabbitMQ`_. You can set up new workers without |
  75. | | central configuration (e.g. use your dads laptop |
  76. | | while the queue is temporarily overloaded). |
  77. +-----------------+----------------------------------------------------+
  78. | Concurrency | Tasks are executed in parallel using the |
  79. | | ``multiprocessing`` module. |
  80. +-----------------+----------------------------------------------------+
  81. | Scheduling | Supports recurring tasks like cron, or specifying |
  82. | | an exact date or countdown for when after the task |
  83. | | should be executed. |
  84. +-----------------+----------------------------------------------------+
  85. | Performance | Able to execute tasks while the user waits. |
  86. +-----------------+----------------------------------------------------+
  87. | Return Values | Task return values can be saved to the selected |
  88. | | result store backend. You can wait for the result, |
  89. | | retrieve it later, or ignore it. |
  90. +-----------------+----------------------------------------------------+
  91. | Result Stores | Database, `MongoDB`_, `Redis`_, `Tokyo Tyrant`, |
  92. | | `AMQP`_ (high performance). |
  93. +-----------------+----------------------------------------------------+
  94. | Webhooks | Your tasks can also be HTTP callbacks, enabling |
  95. | | cross-language communication. |
  96. +-----------------+----------------------------------------------------+
  97. | Rate limiting | Supports rate limiting by using the token bucket |
  98. | | algorithm, which accounts for bursts of traffic. |
  99. | | Rate limits can be set for each task type, or |
  100. | | globally for all. |
  101. +-----------------+----------------------------------------------------+
  102. | Routing | Using AMQP you can route tasks arbitrarily to |
  103. | | different workers. |
  104. +-----------------+----------------------------------------------------+
  105. | Remote-control | You can rate limit and delete (revoke) tasks |
  106. | | remotely. |
  107. +-----------------+----------------------------------------------------+
  108. | Monitoring | You can capture everything happening with the |
  109. | | workers in real-time by subscribing to events. |
  110. | | A real-time web monitor is in development. |
  111. +-----------------+----------------------------------------------------+
  112. | Serialization | Supports Pickle, JSON, YAML, or easily defined |
  113. | | custom schemes. One task invocation can have a |
  114. | | different scheme than another. |
  115. +-----------------+----------------------------------------------------+
  116. | Tracebacks | Errors and tracebacks are stored and can be |
  117. | | investigated after the fact. |
  118. +-----------------+----------------------------------------------------+
  119. | UUID | Every task has an UUID (Universally Unique |
  120. | | Identifier), which is the task id used to query |
  121. | | task status and return value. |
  122. +-----------------+----------------------------------------------------+
  123. | Retries | Tasks can be retried if they fail, with |
  124. | | configurable maximum number of retries, and delays |
  125. | | between each retry. |
  126. +-----------------+----------------------------------------------------+
  127. | Task Sets | A Task set is a task consisting of several |
  128. | | sub-tasks. You can find out how many, or if all |
  129. | | of the sub-tasks has been executed, and even |
  130. | | retrieve the results in order. Progress bars, |
  131. | | anyone? |
  132. +-----------------+----------------------------------------------------+
  133. | Made for Web | You can query status and results via URLs, |
  134. | | enabling the ability to poll task status using |
  135. | | Ajax. |
  136. +-----------------+----------------------------------------------------+
  137. | Error e-mails | Can be configured to send e-mails to the |
  138. | | administrators when tasks fails. |
  139. +-----------------+----------------------------------------------------+
  140. | Supervised | Pool workers are supervised and automatically |
  141. | | replaced if they crash. |
  142. +-----------------+----------------------------------------------------+
  143. .. _`clustering`: http://www.rabbitmq.com/clustering.html
  144. .. _`AMQP`: http://www.amqp.org/
  145. .. _`Stomp`: http://stomp.codehaus.org/
  146. .. _`MongoDB`: http://www.mongodb.org/
  147. .. _`Tokyo Tyrant`: http://tokyocabinet.sourceforge.net/
  148. .. _celery-documentation:
  149. Documentation
  150. =============
  151. The `latest documentation`_ with user guides, tutorials and API reference
  152. is hosted at Github.
  153. .. _`latest documentation`: http://ask.github.com/celery/
  154. .. _celery-installation:
  155. Installation
  156. ============
  157. You can install ``celery`` either via the Python Package Index (PyPI)
  158. or from source.
  159. To install using ``pip``,::
  160. $ pip install celery
  161. To install using ``easy_install``,::
  162. $ easy_install celery
  163. .. _celery-installing-from-source:
  164. Downloading and installing from source
  165. --------------------------------------
  166. Download the latest version of ``celery`` from
  167. http://pypi.python.org/pypi/celery/
  168. You can install it by doing the following,::
  169. $ tar xvfz celery-0.0.0.tar.gz
  170. $ cd celery-0.0.0
  171. $ python setup.py build
  172. # python setup.py install # as root
  173. .. _celery-installing-from-git:
  174. Using the development version
  175. -----------------------------
  176. You can clone the repository by doing the following::
  177. $ git clone git://github.com/ask/celery.git
  178. .. _getting-help:
  179. Getting Help
  180. ============
  181. .. _mailing-list:
  182. Mailing list
  183. ------------
  184. For discussions about the usage, development, and future of celery,
  185. please join the `celery-users`_ mailing list.
  186. .. _`celery-users`: http://groups.google.com/group/celery-users/
  187. .. _irc-channel:
  188. IRC
  189. ---
  190. Come chat with us on IRC. The `#celery`_ channel is located at the `Freenode`_
  191. network.
  192. .. _`#celery`: irc://irc.freenode.net/celery
  193. .. _`Freenode`: http://freenode.net
  194. .. _bug-tracker:
  195. Bug tracker
  196. ===========
  197. If you have any suggestions, bug reports or annoyances please report them
  198. to our issue tracker at http://github.com/ask/celery/issues/
  199. .. _wiki:
  200. Wiki
  201. ====
  202. http://wiki.github.com/ask/celery/
  203. .. _contributing:
  204. Contributing
  205. ============
  206. Development of ``celery`` happens at Github: http://github.com/ask/celery
  207. You are highly encouraged to participate in the development
  208. of ``celery``. If you don't like Github (for some reason) you're welcome
  209. to send regular patches.
  210. .. _license:
  211. License
  212. =======
  213. This software is licensed under the ``New BSD License``. See the ``LICENSE``
  214. file in the top distribution directory for the full license text.
  215. .. # vim: syntax=rst expandtab tabstop=4 shiftwidth=4 shiftround