introduction.txt 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. :Version: 3.0.0 (Chiastic Slide)
  2. :Web: http://celeryproject.org/
  3. :Download: http://pypi.python.org/pypi/celery/
  4. :Source: http://github.com/celery/celery/
  5. :Keywords: task queue, job queue, asynchronous, rabbitmq, amqp, redis,
  6. python, webhooks, queue, distributed
  7. --
  8. .. contents::
  9. :local:
  10. :depth: 1
  11. What is a Task Queue?
  12. =====================
  13. Task queues are used as a mechanism to distribute work across threads or
  14. machines.
  15. A task queue's input is a unit of work, called a task, dedicated worker
  16. processes then constantly monitor the queue for new work to perform.
  17. Celery communicates via messages using a broker
  18. to mediate between clients and workers. To initiate a task a client puts a
  19. message on the queue, the broker then delivers the message to a worker.
  20. A Celery system can consist of multiple workers and brokers, giving way
  21. to high availability and horizontal scaling.
  22. Celery is written in Python, but the protocol can be implemented in any
  23. language. So far there's RCelery_ for the Ruby programming language, and a
  24. `PHP client`, but language interoperability can also be achieved
  25. by using webhooks.
  26. .. _RCelery: http://leapfrogdevelopment.github.com/rcelery/
  27. .. _`PHP client`: https://github.com/gjedeer/celery-php
  28. .. _`using webhooks`:
  29. http://celery.github.com/celery/userguide/remote-tasks.html
  30. What do I need?
  31. ===============
  32. Celery version 3.0 runs on,
  33. - Python ❨2.5, 2.6, 2.7, 3.2, 3.3❩
  34. - PyPy ❨1.8, 1.9❩
  35. - Jython ❨2.5, 2.7❩.
  36. This is the last version to support Python 2.5,
  37. and from Celery 3.1, Python 2.6 or later is required.
  38. The last version to support Python 2.4 was Celery series 2.2.
  39. *Celery* requires a message broker to send and receive messages.
  40. The RabbitMQ, Redis and MongoDB broker transports are feature complete,
  41. but there's also support for a myriad of other solutions, including
  42. using SQLite for local development.
  43. *Celery* can run on a single machine, on multiple machines, or even
  44. across datacenters.
  45. Get Started
  46. ===========
  47. If this is the first time you're trying to use Celery, or you are
  48. new to Celery 3.0 coming from previous versions then you should read our
  49. getting started tutorials:
  50. - `First steps with Celery`_
  51. Tutorial teaching you the bare minimum needed to get started with Celery.
  52. - `Next steps`_
  53. A more complete overview, showing more features.
  54. .. _`First steps with Celery`:
  55. http://docs.celeryproject.org/en/latest/getting-started/first-steps-with-celery.html
  56. .. _`Next steps`:
  57. http://docs.celeryproject.org/en/latest/getting-started/next-steps.html
  58. Celery is…
  59. ==========
  60. - **Simple**
  61. Celery is easy to use and maintain, and does *not need configuration files*.
  62. It has an active, friendly community you can talk to for support,
  63. including a `mailing-list`_ and and an IRC channel.
  64. Here's one of the simplest applications you can make::
  65. from celery import Celery
  66. celery = Celery('hello', broker='amqp://guest@localhost//')
  67. @celery.task()
  68. def hello():
  69. return 'hello world'
  70. - **Highly Available**
  71. Workers and clients will automatically retry in the event
  72. of connection loss or failure, and some brokers support
  73. HA in way of *Master/Master* or *Master/Slave* replication.
  74. - **Fast**
  75. A single Celery process can process millions of tasks a minute,
  76. with sub-millisecond round-trip latency (using RabbitMQ,
  77. py-librabbitmq, and optimized settings).
  78. - **Flexible**
  79. Almost every part of *Celery* can be extended or used on its own,
  80. Custom pool implementations, serializers, compression schemes, logging,
  81. schedulers, consumers, producers, autoscalers, broker transports and much more.
  82. It supports...
  83. ==============
  84. - **Brokers**
  85. - RabbitMQ_, Redis_,
  86. - MongoDB_, Beanstalk_,
  87. - CouchDB_, SQLAlchemy_,
  88. - Django ORM, Amazon SQS,
  89. - and more…
  90. - **Concurrency**
  91. - multiprocessing, Eventlet_, gevent_, threads/single threaded
  92. - **Result Stores**
  93. - AMQP, Redis
  94. - memcached, MongoDB
  95. - SQLAlchemy, Django ORM
  96. - Apache Cassandra
  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: http://rabbitmq.com
  104. .. _Redis: http://redis.io
  105. .. _MongoDB: http://mongodb.org
  106. .. _Beanstalk: http://kr.github.com/beanstalkd
  107. .. _CouchDB: http://couchdb.apache.org
  108. .. _SQLAlchemy: http://sqlalchemy.org
  109. Framework Integration
  110. =====================
  111. Celery is easy to integrate with web frameworks, some of which even have
  112. integration packages:
  113. +--------------------+------------------------+
  114. | `Django`_ | `django-celery`_ |
  115. +--------------------+------------------------+
  116. | `Pyramid`_ | `pyramid_celery`_ |
  117. +--------------------+------------------------+
  118. | `Pylons`_ | `celery-pylons`_ |
  119. +--------------------+------------------------+
  120. | `Flask`_ | not needed |
  121. +--------------------+------------------------+
  122. | `web2py`_ | `web2py-celery`_ |
  123. +--------------------+------------------------+
  124. | `Tornado`_ | `tornado-celery`_ |
  125. +--------------------+------------------------+
  126. The integration packages are not strictly necessary, but they can make
  127. development easier, and sometimes they add important hooks like closing
  128. database connections at ``fork``.
  129. .. _`Django`: http://djangoproject.com/
  130. .. _`Pylons`: http://pylonshq.com/
  131. .. _`Flask`: http://flask.pocoo.org/
  132. .. _`web2py`: http://web2py.com/
  133. .. _`Bottle`: http://bottlepy.org/
  134. .. _`Pyramid`: http://docs.pylonsproject.org/en/latest/docs/pyramid.html
  135. .. _`pyramid_celery`: http://pypi.python.org/pypi/pyramid_celery/
  136. .. _`django-celery`: http://pypi.python.org/pypi/django-celery
  137. .. _`celery-pylons`: http://pypi.python.org/pypi/celery-pylons
  138. .. _`web2py-celery`: http://code.google.com/p/web2py-celery/
  139. .. _`Tornado`: http://www.tornadoweb.org/
  140. .. _`tornado-celery`: http://github.com/mher/tornado-celery/
  141. .. _celery-documentation:
  142. Documentation
  143. =============
  144. The `latest documentation`_ with user guides, tutorials and API reference
  145. is hosted at Read The Docs.
  146. .. _`latest documentation`: http://docs.celeryproject.org/en/latest/