Ask Solem 8 anos atrás
pai
commit
ad2ea9b808

+ 1 - 1
celery/app/task.py

@@ -797,7 +797,7 @@ class Task(object):
                 :setting:`task_publish_retry` setting.
             retry_policy (Mapping): Retry settings.  Default is taken
                 from the :setting:`task_publish_retry_policy` setting.
-            **fields (**Any): Map containing information about the event.
+            **fields (Any): Map containing information about the event.
                 Must be JSON serializable.
         """
         req = self.request

+ 1 - 1
celery/exceptions.py

@@ -31,7 +31,7 @@ Error Hierarchy
             .. note::
                 This exception does not inherit from
                 :exc:`~celery.exceptions.CeleryError`.
-    - **billiard errors (prefork pool)
+    - **billiard errors** (prefork pool)
         - :exc:`~celery.exceptions.SoftTimeLimitExceeded`
         - :exc:`~celery.exceptions.TimeLimitExceeded`
         - :exc:`~celery.exceptions.WorkerLostError`

+ 1 - 1
celery/worker/consumer/consumer.py

@@ -372,7 +372,7 @@ class Consumer(object):
         doesn't enter a loop.
 
         Arguments:
-            message (Message): The message received.
+            message (kombu.Message): The message received.
             exc (Exception): The exception being handled.
         """
         crit(MESSAGE_DECODE_ERROR,

+ 8 - 0
docs/_ext/celerydocs.py

@@ -1,6 +1,7 @@
 from __future__ import absolute_import, unicode_literals
 
 import sys
+import typing
 
 from docutils import nodes
 
@@ -100,6 +101,13 @@ def get_abbr(pre, rest, type, orig=None):
 
 
 def resolve(S, type):
+    if '.' not in S:
+        try:
+            getattr(typing, S)
+        except AttributeError:
+            pass
+        else:
+            return 'typing.{0}'.format(S), None
     orig = S
     if S.startswith('@'):
         S = S.lstrip('@-')

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

@@ -908,7 +908,7 @@ News
    :meth:`~celery.task.base.Task.on_failure` as ``einfo`` keyword argument.
 
 * Worker: Added :setting:`CELERYD_MAX_TASKS_PER_CHILD` /
-  :option:`celery worker --maxtasksperchild`
+  ``celery worker --maxtasksperchild``.
 
     Defines the maximum number of tasks a pool worker can process before
     the process is terminated and replaced by a new one.

+ 1 - 0
docs/reference/index.rst

@@ -51,6 +51,7 @@
     celery.beat
     celery.apps.worker
     celery.apps.beat
+    celery.apps.multi
     celery.worker
     celery.worker.request
     celery.worker.state

+ 12 - 12
docs/userguide/testing.rst

@@ -125,10 +125,10 @@ Fixtures
 --------
 
 Function scope
-~~~~~~~~~~~~~~
+^^^^^^^^^^^^^^
 
 ``celery_app`` - Celery app used for testing.
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 This fixture returns a Celery app you can use for testing.
 
@@ -144,7 +144,7 @@ Example:
         assert mul.delay(4, 4).get(timeout=10) == 16
 
 ``celery_worker`` - Embed live worker.
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 This fixture starts a Celery worker instance that you can use
 for integration tests.  The worker will be started in a *separate thread*
@@ -173,10 +173,10 @@ Example:
         ...
 
 Session scope
-~~~~~~~~~~~~~
+^^^^^^^^^^^^^
 
 ``celery_config`` - Override to setup Celery test app configuration.
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 You can redefine this fixture to configure the test Celery app.
 
 The config returned by your fixture will then be used
@@ -194,7 +194,7 @@ Example:
         }
 
 ``celery_enable_logging`` - Override to enable logging in embedded workers.
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 This is a fixture you can override to enable logging in embedded workers.
 
@@ -207,7 +207,7 @@ Example:
         return True
 
 ``celery_includes`` - Add additional imports for embedded workers.
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 You can override fixture to include modules when an embedded worker starts.
 
 You can have this return a list of module names to import,
@@ -225,7 +225,7 @@ Example:
         ]
 
 ``celery_worker_pool`` - Override the pool used for embedded workers.
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 You can override fixture to configure the execution pool used for embedded
 workers.
 
@@ -243,7 +243,7 @@ Example:
     suite is running with the monkeypatches enabled.
 
 ``celery_session_worker`` - Embedded worker that lives throughout the session.
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 This fixture starts a worker that lives throughout the testing session
 (it won't be started/stopped for every test).
@@ -269,13 +269,13 @@ Example:
     It's probably a bad idea to mix session and ephemeral workers...
 
 ``celery_session_app`` - Celery app used for testing (session scope).
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 This can be used by other session scoped fixtures when they need to refer
 to a Celery app instance.
 
 ``use_celery_app_trap`` - Raise exception on falling back to default app.
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 This is a fixture you can override in your ``conftest.py``, to enable the "app trap":
 if something tries to access the default or current_app, an exception
@@ -293,7 +293,7 @@ Example:
 If a test wants to access the default app, you would have to mark it using
 the ``depends_on_current_app`` fixture:
 
-.. code-block::
+.. code-block:: python
 
     @pytest.mark.usefixtures('depends_on_current_app')
     def test_something():

+ 3 - 4
docs/whatsnew-3.1.rst

@@ -266,10 +266,9 @@ Caveats
     must then be moved back and rewritten to a new process.
 
     This is very expensive if you have the
-    :option:`--maxtasksperchild <celery worker --maxtasksperchild>` option
-    set to a low value (e.g., less than 10), so if you need to enable this option
-    you should also enable :option:`-Ofair <celery worker -O>` to turn off the
-    prefetching behavior.
+    :option:`--max-tasks-per-child <celery worker --max-tasks-per-child>`
+    option set to a low value (e.g., less than 10), you should not be
+    using the :option:`-Ofast <celery worker -O>` scheduler option.
 
 Django supported out of the box
 -------------------------------

+ 2 - 0
docs/whatsnew-4.0.rst

@@ -390,6 +390,8 @@ The Json serializer now also supports some additional types:
 You can also define a ``__json__`` method on your custom classes to support
 JSON serialization (must return a json compatible type):
 
+.. code-block:: python
+
     class Person:
         first_name = None
         last_name = None

+ 1 - 0
requirements/docs.txt

@@ -1,3 +1,4 @@
 sphinx_celery>=1.3
+typing
 -r extras/sqlalchemy.txt
 -r dev.txt