瀏覽代碼

Merge branch 'master' of git://github.com/ask/celery

unknown 15 年之前
父節點
當前提交
8774ea9db6
共有 4 個文件被更改,包括 62 次插入42 次删除
  1. 1 0
      AUTHORS
  2. 22 25
      celery/conf.py
  3. 3 2
      celery/pool.py
  4. 36 15
      docs/configuration.rst

+ 1 - 0
AUTHORS

@@ -6,3 +6,4 @@ Ordered by date of first contribution:
   Sean Creeley <sean.creeley@gmail.com>
   Ben Firshman <ben@firshman.co.uk>
   Augusto Becciu <augusto@becciu.org>
+  Jonatan Heyman <jonatan@heyman.info>

+ 22 - 25
celery/conf.py

@@ -15,7 +15,6 @@ DEFAULT_DAEMON_LOG_LEVEL = "INFO"
 DEFAULT_DAEMON_LOG_FILE = "celeryd.log"
 DEFAULT_AMQP_CONNECTION_TIMEOUT = 4
 DEFAULT_STATISTICS = False
-DEFAULT_STATISTICS_COLLECT_INTERVAL = 60 * 5
 DEFAULT_ALWAYS_EAGER = False
 DEFAULT_TASK_RESULT_EXPIRES = timedelta(days=5)
 DEFAULT_AMQP_CONNECTION_RETRY = True
@@ -172,24 +171,10 @@ SEND_CELERY_TASK_ERROR_EMAILS = getattr(settings,
                                         "SEND_CELERY_TASK_ERROR_EMAILS",
                                         not settings.DEBUG)
 
-"""
-.. data:: STATISTICS_COLLECT_INTERVAL
-
-    The interval in seconds of which the
-    :class:`celery.task.CollectStatisticsTask`` is run.
-
-"""
-STATISTICS_COLLECT_INTERVAL = getattr(settings,
-                                "CELERY_STATISTICS_COLLECT_INTERVAL",
-                                DEFAULT_STATISTICS_COLLECT_INTERVAL)
-
 """
 .. data:: ALWAYS_EAGER
 
-    If this is ``True``, all tasks will be executed locally by blocking
-    until it is finished. ``apply_async`` and ``delay_task`` will return
-    a :class:`celery.result.EagerResult` which emulates the behaviour of
-    an :class:`celery.result.AsyncResult`.
+    Always execute tasks locally, don't send to the queue.
 
 """
 ALWAYS_EAGER = getattr(settings, "CELERY_ALWAYS_EAGER",
@@ -198,9 +183,8 @@ ALWAYS_EAGER = getattr(settings, "CELERY_ALWAYS_EAGER",
 """
 .. data: TASK_RESULT_EXPIRES
 
-    Time (in seconds, or a :class:`datetime.timedelta` object) for when after
-    stored task results are deleted. For the moment this only works for the
-    database backend.
+    Task tombstone expire time in seconds.
+
 """
 TASK_RESULT_EXPIRES = getattr(settings, "CELERY_TASK_RESULT_EXPIRES",
                               DEFAULT_TASK_RESULT_EXPIRES)
@@ -213,13 +197,10 @@ if isinstance(TASK_RESULT_EXPIRES, int):
 .. data:: AMQP_CONNECTION_RETRY
 
 Automatically try to re-establish the connection to the AMQP broker if
-it's lost. The time between retries is increased for each retry, and is
-not exhausted before :data:`AMQP_CONNECTION_MAX_RETRIES` is exceeded.
-
-On by default.
+it's lost.
 
 """
-AMQP_CONNECTION_RETRY = getattr(settings, "AMQP_CONNECTION_RETRY",
+AMQP_CONNECTION_RETRY = getattr(settings, "CELERY_AMQP_CONNECTION_RETRY",
                                 DEFAULT_AMQP_CONNECTION_RETRY)
 
 """
@@ -234,7 +215,7 @@ Default is ``100`` retries.
 
 """
 AMQP_CONNECTION_MAX_RETRIES = getattr(settings,
-                                      "AMQP_CONNECTION_MAX_RETRIES",
+                                      "CELERY_AMQP_CONNECTION_MAX_RETRIES",
                                       DEFAULT_AMQP_CONNECTION_MAX_RETRIES)
 
 """
@@ -252,7 +233,23 @@ TASK_SERIALIZER = getattr(settings, "CELERY_TASK_SERIALIZER",
                           DEFAULT_TASK_SERIALIZER)
 
 
+"""
+
+.. data:: CELERY_BACKEND
+
+The backend used to store task results (tombstones).
+
+"""
 CELERY_BACKEND = getattr(settings, "CELERY_BACKEND", DEFAULT_BACKEND)
+
+
+"""
+
+.. data:: CELERY_PERIODIC_STATUS_BACKEND
+
+The backend used to store the status of periodic tasks.
+
+"""
 CELERY_PERIODIC_STATUS_BACKEND = getattr(settings,
                                     "CELERY_PERIODIC_STATUS_BACKEND",
                                     DEFAULT_PERIODIC_STATUS_BACKEND)

+ 3 - 2
celery/pool.py

@@ -68,8 +68,9 @@ def process_is_dead(process):
     
     # Try to see if the process is actually running,
     # and reap zombie proceses while we're at it.
-    # Only do this if os.kill exists. It doesn't on windows.
-    
+
+    # Only do this if os.kill exists for this platform (e.g. Windows doesn't
+    # support it).
     if callable(getattr(os, "kill", None)) and reap_process(process.pid):
         return True
 

+ 36 - 15
docs/configuration.rst

@@ -45,7 +45,7 @@ Concurrency settings
 * CELERYD_CONCURRENCY
     The number of concurrent worker processes, executing tasks simultaneously.
 
-    Defaults to the number of CPUs in the system. 
+    Defaults to the number of CPUs in the system.
 
 
 Task result backend settings
@@ -158,34 +158,55 @@ Example configuration
 MongoDB backend settings
 ========================
 
+**NOTE** The MongoDB backend requires the :mod:`pymongo` library:
+    http://github.com/mongodb/mongo-python-driver/tree/master
+
 * CELERY_MONGODB_BACKEND_SETTINGS
-    This is a dict supporting the following keys
+
+    This is a dict supporting the following keys:
 
     * host
-        Hostname of the MongoDB server.
+        Hostname of the MongoDB server. Defaults to "localhost".
 
     * port
-        The port the MongoDB server is listening to.
+        The port the MongoDB server is listening to. Defaults to 27017.
 
     * user
-        Username to authenticate to the MongoDB server as.
+        Username to authenticate to the MongoDB server as (optional).
 
     * password
+        Password to authenticate to the MongoDB server (optional).
 
     * database
-        The database name to connect to.
+        The database name to connect to. Defaults to "celery".
 
     * taskmeta_collection
-        FIXME
+        The collection name to store task metadata.
+        Defaults to "celery_taskmeta".
 
     * periodictaskmeta_collection
-        FIXME
+        The collection name to store periodic task metadata.
+        Defaults to "celery_periodictaskmeta".
+
+
+Example configuration
+---------------------
+
+.. code-block:: python
+
+    CELERY_MONGODB_BACKEND_SETTINGS = {
+        "host": "192.168.1.100",
+        "port": 30000,
+        "database": "mydb",
+        "taskmeta_collection": "my_taskmeta_collection",
+    }
+
 
 Broker settings
 ===============
 
 * CELERY_AMQP_EXCHANGE
-    
+
     Name of the AMQP exchange.
 
 * CELERY_AMQP_EXCHANGE_TYPE
@@ -216,7 +237,7 @@ Broker settings
 * CELERY_AMQP_CONNECTION_RETRY
     Automatically try to re-establish the connection to the AMQP broker if
     it's lost.
-    
+
     The time between retries is increased for each retry, and is
     not exhausted before ``CELERY_AMQP_CONNECTION_MAX_RETRIES`` is exceeded.
 
@@ -249,16 +270,16 @@ Task execution settings
 * CELERY_TASK_RESULT_EXPIRES
     Time (in seconds, or a :class:`datetime.timedelta` object) for when after
     stored task tombstones are deleted.
-    
+
     **NOTE**: For the moment this only works for the database and MongoDB
     backends.
-  
+
 * CELERY_TASK_SERIALIZER
     A string identifying the default serialization
     method to use. Can be ``pickle`` (default),
     ``json``, ``yaml``, or any custom serialization methods that have
     been registered with :mod:`carrot.serialization.registry`.
-    
+
     Default is ``pickle``.
 
 Logging settings
@@ -267,7 +288,7 @@ Logging settings
 * CELERYD_LOG_FILE
     The default filename the worker daemon logs messages to, can be
     overridden using the `--logfile`` option to ``celeryd``.
-    
+
     The default is to log using ``stderr`` if running in the foreground,
     when running in the background, detached as a daemon, the default
     logfile is ``celeryd.log``.
@@ -275,7 +296,7 @@ Logging settings
 * CELERYD_DAEMON_LOG_LEVEL
     Worker log level, can be any of ``DEBUG``, ``INFO``, ``WARNING``,
     ``ERROR``, ``CRITICAL``, or ``FATAL``.
-    
+
     See the :mod:`logging` module for more information.
 
 * CELERYD_DAEMON_LOG_FORMAT