浏览代码

Adds worker bootstep graphs to docs

Ask Solem 12 年之前
父节点
当前提交
36532b6a20
共有 6 个文件被更改,包括 37 次插入3 次删除
  1. 1 0
      celery/worker/consumer.py
  2. 7 0
      docs/glossary.rst
  3. 2 2
      docs/history/changelog-2.0.rst
  4. 1 0
      docs/reference/index.rst
  5. 20 1
      docs/userguide/extending.rst
  6. 6 0
      pavement.py

+ 1 - 0
celery/worker/consumer.py

@@ -458,6 +458,7 @@ class Tasks(bootsteps.StartStopStep):
 
 
 
 
 class Agent(bootsteps.StartStopStep):
 class Agent(bootsteps.StartStopStep):
+    conditional = True
     requires = (Connection, )
     requires = (Connection, )
 
 
     def __init__(self, c, **kwargs):
     def __init__(self, c, **kwargs):

+ 7 - 0
docs/glossary.rst

@@ -15,6 +15,13 @@ Glossary
         Sends a task message so that the task function is
         Sends a task message so that the task function is
         :term:`executed <executing>` by a worker.
         :term:`executed <executing>` by a worker.
 
 
+    kombu
+        Python messaging library used by Celery to send and receive messages.
+
+    billiard
+        Fork of the Python multiprocessing library containing improvements
+        required by Celery.
+
     executing
     executing
         Workers *execute* task :term:`requests <request>`.
         Workers *execute* task :term:`requests <request>`.
 
 

+ 2 - 2
docs/history/changelog-2.0.rst

@@ -569,10 +569,10 @@ Backward incompatible changes
     =====================================  =====================================
     =====================================  =====================================
 
 
 * The `celery.task.rest` module has been removed, use :mod:`celery.task.http`
 * The `celery.task.rest` module has been removed, use :mod:`celery.task.http`
-  instead (as scheduled by the `deprecation timeline`_).
+  instead (as scheduled by the :ref:`deprecation-timeline`).
 
 
 * It's no longer allowed to skip the class name in loader names.
 * It's no longer allowed to skip the class name in loader names.
-  (as scheduled by the `deprecation timeline`_):
+  (as scheduled by the :ref:`deprecation-timeline`):
 
 
     Assuming the implicit `Loader` class name is no longer supported,
     Assuming the implicit `Loader` class name is no longer supported,
     if you use e.g.::
     if you use e.g.::

+ 1 - 0
docs/reference/index.rst

@@ -20,6 +20,7 @@
     celery.app.builtins
     celery.app.builtins
     celery.app.log
     celery.app.log
     celery.app.utils
     celery.app.utils
+    celery.bootsteps
     celery.task
     celery.task
     celery.task.base
     celery.task.base
     celery.result
     celery.result

+ 20 - 1
docs/userguide/extending.rst

@@ -13,6 +13,22 @@
 Bootsteps
 Bootsteps
 =========
 =========
 
 
+.. _extending-worker-bootsteps:
+
+Worker Bootsteps
+================
+
+.. figure:: ../images/worker_graph.png
+   :width: 700px
+
+
+Consumer Bootsteps
+==================
+
+.. figure:: ../images/consumer_graph.png
+   :width: 700px
+
+
 .. _extending-programs:
 .. _extending-programs:
 
 
 Command-line programs
 Command-line programs
@@ -67,7 +83,7 @@ of :class:`celery.bin.base.Command`.  Sadly there is limited documentation,
 but you can find inspiration from the various commands in the
 but you can find inspiration from the various commands in the
 :mod:`celery.bin` package.
 :mod:`celery.bin` package.
 
 
-This is how the `Flower`_ extension adds the :program:`celery flower` command,
+This is how the Flower_ monitoring extension adds the :program:`celery flower` command,
 by adding an entry-point in :file:`setup.py`:
 by adding an entry-point in :file:`setup.py`:
 
 
 .. code-block:: python
 .. code-block:: python
@@ -82,6 +98,8 @@ by adding an entry-point in :file:`setup.py`:
     )
     )
 
 
 
 
+.. _Flower: http://pypi.python.org/pypi/flower
+
 The command definition is in two parts separated by the equal sign, where the
 The command definition is in two parts separated by the equal sign, where the
 first part is the name of the subcommand (flower), then the fully qualified
 first part is the name of the subcommand (flower), then the fully qualified
 module path to the class that implements the command
 module path to the class that implements the command
@@ -91,6 +109,7 @@ module path to the class that implements the command
 In the module :file:`flower/command.py`, the command class is defined
 In the module :file:`flower/command.py`, the command class is defined
 something like this:
 something like this:
 
 
+.. code-block:: python
 
 
     from celery.bin.base import Command, Option
     from celery.bin.base import Command, Option
 
 

+ 6 - 0
pavement.py

@@ -136,6 +136,12 @@ def removepyc(options):
         ' -o '.join("-name '{0}'".format(pat) for pat in PYCOMPILE_CACHES)))
         ' -o '.join("-name '{0}'".format(pat) for pat in PYCOMPILE_CACHES)))
 
 
 
 
+@task
+def update_graphs(options):
+    sh('celery worker_graph | dot -Tpng -o docs/images/worker_graph.png')
+    sh('celery consumer_graph | dot -Tpng -o docs/images/consumer_graph.png')
+
+
 @task
 @task
 @needs('removepyc')
 @needs('removepyc')
 def gitclean(options):
 def gitclean(options):