Преглед изворни кода

CELERY_BACKEND renamed to CELERY_RESULT_BACKEND, but keep CELERY_BACKEND as a compat setting.

Ask Solem пре 15 година
родитељ
комит
6b3a480e8b

+ 3 - 3
Changelog

@@ -1107,9 +1107,9 @@ arguments, so be sure to flush your task queue before you upgrade.
   a new backend for Tokyo Tyrant. You can set the backend in your django
   settings file. e.g::
 
-		CELERY_BACKEND = "database"; # Uses the database
-		CELERY_BACKEND = "cache"; # Uses the django cache framework
-		CELERY_BACKEND = "tyrant"; # Uses Tokyo Tyrant
+		CELERY_RESULT_BACKEND = "database"; # Uses the database
+		CELERY_RESULT_BACKEND = "cache"; # Uses the django cache framework
+		CELERY_RESULT_BACKEND = "tyrant"; # Uses Tokyo Tyrant
 		TT_HOST = "localhost"; # Hostname for the Tokyo Tyrant server.
 		TT_PORT = 6657; # Port of the Tokyo Tyrant server.
 

+ 1 - 1
FAQ

@@ -538,7 +538,7 @@ configuration using the database backend with MySQL:
     CARROT_BACKEND="amqp"
 
     # Using the database backend.
-    CELERY_BACKEND = "database"
+    CELERY_RESULT_BACKEND = "database"
     DATABASE_ENGINE = "mysql" # see Django docs for a description of these.
     DATABASE_NAME = "mydb"
     DATABASE_HOST = "mydb.example.org"

+ 3 - 3
celery/backends/__init__.py

@@ -40,17 +40,17 @@ def get_backend_cls(backend):
 """
 .. function:: get_default_backend_cls()
 
-    Get the backend class specified in :setting:`CELERY_BACKEND`.
+    Get the backend class specified in :setting:`CELERY_RESULT_BACKEND`.
 
 """
-get_default_backend_cls = curry(get_backend_cls, conf.CELERY_BACKEND)
+get_default_backend_cls = curry(get_backend_cls, conf.CELERY_RESULT_BACKEND)
 
 
 """
 .. class:: DefaultBackend
 
     The default backend class used for storing task results and status,
-    specified in :setting:`CELERY_BACKEND`.
+    specified in :setting:`CELERY_RESULT_BACKEND`.
 
 """
 DefaultBackend = get_default_backend_cls()

+ 1 - 1
celery/bin/celeryd.py

@@ -137,7 +137,7 @@ class Worker(object):
 
         self.init_loader()
 
-        if conf.CELERY_BACKEND == "database" \
+        if conf.RESULT_BACKEND == "database" \
                 and self.settings.DATABASE_ENGINE == "sqlite3" and \
                 self.concurrency > 1:
             warnings.warn("The sqlite3 database engine doesn't handle "

+ 3 - 2
celery/conf.py

@@ -14,7 +14,7 @@ LOG_LEVELS[logging.FATAL] = "FATAL"
 settings = load_settings()
 
 _DEFAULTS = {
-    "CELERY_BACKEND": "database",
+    "CELERY_RESULT_BACKEND": "database",
     "CELERY_ALWAYS_EAGER": False,
     "CELERY_TASK_RESULT_EXPIRES": timedelta(days=5),
     "CELERY_SEND_EVENTS": False,
@@ -74,7 +74,8 @@ def _get(name, default=None, compat=None):
 
 # <--- Task                                        <-   --   --- - ----- -- #
 ALWAYS_EAGER = _get("CELERY_ALWAYS_EAGER")
-CELERY_BACKEND = _get("CELERY_BACKEND")
+RESULT_BACKEND = _get("CELERY_RESULT_BACKEND", compat=["CELERY_BACKEND"])
+CELERY_BACKEND = RESULT_BACKEND # FIXME Remove in 1.4
 CELERY_CACHE_BACKEND = _get("CELERY_CACHE_BACKEND")
 TASK_SERIALIZER = _get("CELERY_TASK_SERIALIZER")
 TASK_RESULT_EXPIRES = _get("CELERY_TASK_RESULT_EXPIRES")

+ 1 - 1
celery/models.py

@@ -62,6 +62,6 @@ class TaskSetMeta(models.Model):
 if (django.VERSION[0], django.VERSION[1]) >= (1, 1):
     # keep models away from syncdb/reset if database backend is not
     # being used.
-    if conf.CELERY_BACKEND != 'database':
+    if conf.RESULT_BACKEND != 'database':
         TaskMeta._meta.managed = False
         TaskSetMeta._meta.managed = False

+ 8 - 8
docs/configuration.rst

@@ -20,7 +20,7 @@ It should contain all you need to run a basic celery set-up.
 
 .. code-block:: python
 
-    CELERY_BACKEND = "database"
+    CELERY_RESULT_BACKEND = "database"
     DATABASE_ENGINE = "sqlite3"
     DATABASE_NAME = "mydatabase.db"
 
@@ -61,7 +61,7 @@ Concurrency settings
 Task result backend settings
 ============================
 
-* CELERY_BACKEND
+* CELERY_RESULT_BACKEND
     The backend used to store task results (tombstones).
     Can be one of the following:
 
@@ -112,7 +112,7 @@ Example configuration
 
 .. code-block:: python
 
-    CELERY_BACKEND = "database"
+    CELERY_RESULT_BACKEND = "database"
     DATABASE_ENGINE = "mysql"
     DATABASE_USER = "myusername"
     DATABASE_PASSWORD = "mypassword"
@@ -127,7 +127,7 @@ The AMQP backend does not have any settings yet.
 Example configuration
 ---------------------
 
-    CELERY_BACKEND = "amqp"
+    CELERY_RESULT_BACKEND = "amqp"
 
 Cache backend settings
 ======================
@@ -152,7 +152,7 @@ Using multiple memcached servers:
 
 .. code-block:: python
 
-    CELERY_BACKEND = "cache"
+    CELERY_RESULT_BACKEND = "cache"
     CACHE_BACKEND = 'memcached://172.19.26.240:11211;172.19.26.242:11211/'
 
 
@@ -176,7 +176,7 @@ Example configuration
 
 .. code-block:: python
 
-    CELERY_BACKEND = "tyrant"
+    CELERY_RESULT_BACKEND = "tyrant"
     TT_HOST = "localhost"
     TT_PORT = 1978
 
@@ -217,7 +217,7 @@ Example configuration
 
 .. code-block:: python
 
-    CELERY_BACKEND = "redis"
+    CELERY_RESULT_BACKEND = "redis"
     REDIS_HOST = "localhost"
     REDIS_PORT = 6379
     REDIS_DATABASE = "celery_results"
@@ -258,7 +258,7 @@ Example configuration
 
 .. code-block:: python
 
-    CELERY_BACKEND = "mongodb"
+    CELERY_RESULT_BACKEND = "mongodb"
     CELERY_MONGODB_BACKEND_SETTINGS = {
         "host": "192.168.1.100",
         "port": 30000,

+ 1 - 1
docs/getting-started/first-steps-with-celery.rst

@@ -56,7 +56,7 @@ Let's create our ``celeryconfig.py``.
 2. In this example we don't want to store the results of the tasks, so
    we'll use the simplest backend available; the AMQP backend::
 
-        CELERY_BACKEND = "amqp"
+        CELERY_RESULT_BACKEND = "amqp"
 
 3. Finally, we list the modules to import, that is, all the modules
    that contain tasks. This is so celery knows about what tasks it can

+ 1 - 1
docs/reference/celery.conf.rst

@@ -63,7 +63,7 @@ Configuration - celery.conf
 
     Default is ``pickle``.
 
-.. data:: CELERY_BACKEND
+.. data:: RESULT_BACKEND
 
     The backend used to store task results (tombstones).
 

+ 1 - 1
examples/celery_http_gateway/settings.py

@@ -4,7 +4,7 @@ DEBUG = True
 TEMPLATE_DEBUG = DEBUG
 
 CARROT_BACKEND = "amqp"
-CELERY_BACKEND = "database"
+CELERY_RESULT_BACKEND = "database"
 BROKER_HOST = "localhost"
 BROKER_VHOST = "/"
 BROKER_USER = "guest"

+ 1 - 1
examples/pythonproject/demoapp/celeryconfig.py

@@ -8,5 +8,5 @@ BROKER_HOST = "localhost"
 BROKER_USER = "guest"
 BROKER_PASSWORD = "guest"
 BROKER_VHOST = "/"
-CELERY_BACKEND = "amqp"
+CELERY_RESULT_BACKEND = "amqp"
 CELERY_IMPORTS = ("tasks", )