introduction.txt 6.4 KB

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