README.rst 10.0 KB

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