Browse Source

Updates the Celery Deprecation Timeline

Ask Solem 13 years ago
parent
commit
f3110b3667

+ 1 - 1
celery/app/defaults.py

@@ -122,7 +122,7 @@ NAMESPACES = {
         "REDIS_PORT": Option(type="int", **_REDIS_OLD),
         "REDIS_DB": Option(type="int", **_REDIS_OLD),
         "REDIS_PASSWORD": Option(type="string", **_REDIS_OLD),
-        "REDIS_MAX_CONNECTIONS": Option(type="int", **_REDIS_OLD),
+        "REDIS_MAX_CONNECTIONS": Option(type="int"),
         "RESULT_BACKEND": Option(type="string"),
         "RESULT_DB_SHORT_LIVED_SESSIONS": Option(False, type="bool"),
         "RESULT_DBURI": Option(),

+ 4 - 0
contrib/release/verify_config_reference.py

@@ -12,6 +12,10 @@ ignore = frozenset([
     "BROKER_PASSWORD",
     "BROKER_VHOST",
     "BROKER_PORT",
+    "CELERY_REDIS_HOST",
+    "CELERY_REDIS_PORT",
+    "CELERY_REDIS_DB",
+    "CELERY_REDIS_PASSWORD",
 ])
 
 

+ 21 - 26
docs/configuration.rst

@@ -382,6 +382,9 @@ setting:
 Redis backend settings
 ----------------------
 
+Configuring the backend URL
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
 .. note::
 
     The Redis backend requires the :mod:`redis` library:
@@ -391,33 +394,35 @@ Redis backend settings
 
         $ pip install redis
 
-This backend requires the following configuration directives to be set.
+This backend requires the :setting:`CELERY_RESULT_BACKEND`
+setting to be set to a Redis URL::
 
-.. setting:: CELERY_REDIS_HOST
+    CELERY_RESULT_BACKEND = "redis://:password@host:port/db"
 
-CELERY_REDIS_HOST
-~~~~~~~~~~~~~~~~~
+For example::
 
-Host name of the Redis database server. e.g. `"localhost"`.
+    CELERY_RESULT_BACKEND = "redis://localhost/0"
 
-.. setting:: CELERY_REDIS_PORT
+which is the same as::
 
-CELERY_REDIS_PORT
-~~~~~~~~~~~~~~~~~
+    CELERY_RESULT_BACKEND = "redis://"
 
-Port to the Redis database server. e.g. `6379`.
+The fields of the URL is defined as folows:
 
-.. setting:: CELERY_REDIS_DB
+- *host*
 
-CELERY_REDIS_DB
-~~~~~~~~~~~~~~~
+Host name or IP address of the Redis server. e.g. `"localhost"`.
 
-Database number to use. Default is 0
+- *port*
 
-.. setting:: CELERY_REDIS_PASSWORD
+Port to the Redis server. Default is 6379.
 
-CELERY_REDIS_PASSWORD
-~~~~~~~~~~~~~~~~~~~~~
+- *db*
+
+Database number to use. Default is 0.
+The db can include an optional leading slash.
+
+- *password*
 
 Password used to connect to the database.
 
@@ -429,16 +434,6 @@ CELERY_REDIS_MAX_CONNECTIONS
 Maximum number of connections available in the Redis connection
 pool used for sending and retrieving results.
 
-Example configuration
-~~~~~~~~~~~~~~~~~~~~~
-
-.. code-block:: python
-
-    CELERY_RESULT_BACKEND = "redis"
-    CELERY_REDIS_HOST = "localhost"
-    CELERY_REDIS_PORT = 6379
-    CELERY_REDIS_DB = 0
-
 .. _conf-mongodb-result-backend:
 
 MongoDB backend settings

+ 216 - 0
docs/internals/deprecation.rst

@@ -7,6 +7,222 @@
 .. contents::
     :local:
 
+.. _deprecations-v3.0:
+
+Removals for version 3.0
+========================
+
+Old Task API
+------------
+
+.. _deprecate-compat-task-modules:
+
+Compat Task Modules
+~~~~~~~~~~~~~~~~~~~
+
+- Module ``celery.decorators`` will be removed:
+
+  Which means you need to change::
+
+    from celery.decorators import task
+
+Into::
+
+    from celery import task
+
+- Module ``celery.task`` *may* be removed (not decided)
+
+    This means you should change::
+
+        from celery.task import task
+
+    into::
+
+        from celery import task
+
+    -- and::
+
+        from celery.task import Task
+
+    into::
+
+        from celery import Task
+
+
+Note that the new :class:`~celery.Task` class no longer
+uses classmethods for these methods:
+
+    - delay
+    - apply_async
+    - retry
+    - apply
+    - AsyncResult
+    - subtask
+
+This also means that you can't call these methods directly
+on the class, but have to instantiate the task first::
+
+    >>> MyTask.delay()          # NO LONGER WORKS
+
+
+    >>> MyTask().delay()        # WORKS!
+
+
+Magic keyword arguments
+~~~~~~~~~~~~~~~~~~~~~~~
+
+The magic keyword arguments accepted by tasks will be removed
+in 3.0, so you should start rewriting any tasks
+using the ``celery.decorators`` module and depending
+on keyword arguments being passed to the task,
+for example::
+
+    from celery.decorators import task
+
+    @task
+    def add(x, y, task_id=None):
+        print("My task id is %r" % (task_id, ))
+
+must be rewritten into::
+
+    from celery import task
+
+    @task
+    def add(x, y):
+        print("My task id is %r" % (add.request.id, ))
+
+
+Task attributes
+---------------
+
+The task attributes:
+
+- ``queue``
+- ``exchange``
+- ``exchange_type``
+- ``routing_key``
+- ``delivery_mode``
+- ``priority``
+
+is deprecated and must be set by :setting:`CELERY_ROUTES` instead.
+
+:mod:`celery.result`
+--------------------
+
+- ``BaseAsyncResult`` -> ``AsyncResult``.
+
+- ``TaskSetResult.total`` -> ``len(TaskSetResult)``
+
+Apply to: :class:`~celery.result.AsyncResult`,
+:class:`~celery.result.ResultSet`, :class:`~celery.result.EagerResult`,
+:class:`~celery.result.TaskSetResult`.
+
+- ``Result.wait()`` -> ``Result.get()``
+
+- ``Result.task_id()`` -> ``Result.id``
+
+- ``TaskSetResult.taskset_id`` -> ``TaskSetResult.id``
+
+- ``Result.status`` -> ``Result.state``.
+
+:mod:`celery.loader`
+--------------------
+
+- ``current_loader()`` -> ``current_app.loader``
+
+- ``load_settings()`` -> ``current_app.conf``
+
+
+Modules to Remove
+-----------------
+
+- ``celery.execute``
+
+  This module only contains ``send_task``, which must be replaced with
+  :attr:`@send_task` instead.
+
+- ``celery.decorators``
+
+    See :ref:`deprecate-compat-task-modules`
+
+- ``celery.log``
+
+    Use :attr:`@log` instead.
+
+- ``celery.messaging``
+
+    Use :attr:`@amqp` instead.
+
+- ``celery.registry``
+
+    Use :mod:`celery.app.registry` instead.
+
+- ``celery.task.control``
+
+    Use :attr:`@control` instead.
+
+- ``celery.task.schedules``
+
+    Use :mod:`celery.schedules` instead.
+
+- ``celery.task.chords``
+
+    Use :func:`celery.chord` instead.
+
+Settings
+--------
+
+``BROKER`` Settings
+~~~~~~~~~~~~~~~~~~~
+
+    =====================================  =====================================
+    **Setting name**                       **Replace with**
+    =====================================  =====================================
+    ``BROKER_HOST``                        :setting:`BROKER_URL`
+    ``BROKER_PORT``                        :setting:`BROKER_URL`
+    ``BROKER_USER``                        :setting:`BROKER_URL`
+    ``BROKER_PASSWORD``                    :setting:`BROKER_URL`
+    ``BROKER_VHOST``                       :setting:`BROKER_URL`
+    ``BROKER_INSIST``                      *no alternative*
+
+``REDIS`` Result Backend Settings
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+    =====================================  =====================================
+    **Setting name**                       **Replace with**
+    =====================================  =====================================
+    ``CELERY_REDIS_HOST``                  :setting:`CELERY_RESULT_BACKEND`
+    ``CELERY_REDIS_PORT``                  :setting:`CELERY_RESULT_BACKEND`
+    ``CELERY_REDIS_DB``                    :setting:`CELERY_RESULT_BACKEND`
+    ``CELERY_REDIS_PASSWORD``              :setting:`CELERY_RESULT_BACKEND`
+    ``REDIS_HOST``                         :setting:`CELERY_RESULT_BACKEND`
+    ``REDIS_PORT``                         :setting:`CELERY_RESULT_BACKEND`
+    ``REDIS_DB``                           :setting:`CELERY_RESULT_BACKEND`
+    ``REDIS_PASSWORD``                     :setting:`CELERY_RESULT_BACKEND`
+
+Logging Settings
+~~~~~~~~~~~~~~~~
+
+    =====================================  =====================================
+    **Setting name**                       **Replace with**
+    =====================================  =====================================
+    ``CELERYD_LOG_LEVEL``                  :option:`--loglevel`
+    ``CELERYD_LOG_FILE``                   :option:`--logfile``
+    ``CELERYBEAT_LOG_LEVEL``               :option:`--loglevel`
+    ``CELERYBEAT_LOG_FILE``                :option:`--loglevel``
+    ``CELERYMON_LOG_LEVEL``                :option:`--loglevel`
+    ``CELERYMON_LOG_FILE``                 :option:`--loglevel``
+
+Other Settings
+~~~~~~~~~~~~~~
+
+    =====================================  =====================================
+    **Setting name**                       **Replace with**
+    =====================================  =====================================
+    ``CELERY_TASK_ERROR_WITELIST``         Annotate ``Task.ErrorMail``
+    ``CELERY_AMQP_TASK_RESULT_EXPIRES``    :setting:`CELERY_TASK_RESULT_EXPIRES`
+
+
 .. _deprecations-v2.0:
 
 Removals for version 2.0

+ 12 - 3
docs/whatsnew-2.6.rst

@@ -645,17 +645,26 @@ to create tasks out of methods::
 
 See :mod:`celery.contrib.methods` for more information.
 
-.. _v260-deprecations:
+.. _v260-unscheduled-removals:
 
-Deprecations
-============
+Unscheduled Removals
+====================
 
+Usually we don't make backward incompatible removals,
+but these removals should have no major effect.
 
 - The following settings have been renamed:
 
     - ``CELERYD_ETA_SCHEDULER`` -> ``CELERYD_TIMER``
     - ``CELERYD_ETA_SCHEDULER_PRECISION`` -> ``CELERYD_TIMER_PRECISION``
 
+.. _v260-deprecations:
+
+Deprecations
+============
+
+See the :ref:`celery-deprecation-timeline`.
+
 Fixes
 =====