Ask Solem 12 anos atrás
pai
commit
e3c1bb2179
5 arquivos alterados com 20 adições e 30 exclusões
  1. 9 14
      celery/app/builtins.py
  2. 6 6
      celery/bootsteps.py
  3. 1 1
      celery/canvas.py
  4. 0 5
      celery/datastructures.py
  5. 4 4
      celery/platforms.py

+ 9 - 14
celery/app/builtins.py

@@ -20,18 +20,19 @@ _shared_tasks = []
 
 
 
 
 def shared_task(constructor):
 def shared_task(constructor):
-    """Decorator that specifies that the decorated function is a function
-    that generates a built-in task.
+    """Decorator that specifies a function that generates a built-in task.
 
 
     The function will then be called for every new app instance created
     The function will then be called for every new app instance created
     (lazily, so more exactly when the task registry for that app is needed).
     (lazily, so more exactly when the task registry for that app is needed).
+
+    The function must take a single ``app`` argument.
     """
     """
     _shared_tasks.append(constructor)
     _shared_tasks.append(constructor)
     return constructor
     return constructor
 
 
 
 
 def load_shared_tasks(app):
 def load_shared_tasks(app):
-    """Loads the built-in tasks for an app instance."""
+    """Create built-in tasks for an app instance."""
     for constructor in _shared_tasks:
     for constructor in _shared_tasks:
         constructor(app)
         constructor(app)
 
 
@@ -41,16 +42,11 @@ def add_backend_cleanup_task(app):
     """The backend cleanup task can be used to clean up the default result
     """The backend cleanup task can be used to clean up the default result
     backend.
     backend.
 
 
-    This task is also added do the periodic task schedule so that it is
-    run every day at midnight, but :program:`celery beat` must be running
-    for this to be effective.
-
-    Note that not all backends do anything for this, what needs to be
-    done at cleanup is up to each backend, and some backends
-    may even clean up in realtime so that a periodic cleanup is not necessary.
+    If the configured backend requires periodic cleanup this task is also
+    automatically configured to run every day at midnight (requires
+    :program:`celery beat` to be running).
 
 
     """
     """
-
     @app.task(name='celery.backend_cleanup', _force_evaluate=True)
     @app.task(name='celery.backend_cleanup', _force_evaluate=True)
     def backend_cleanup():
     def backend_cleanup():
         app.backend.cleanup()
         app.backend.cleanup()
@@ -59,10 +55,9 @@ def add_backend_cleanup_task(app):
 
 
 @shared_task
 @shared_task
 def add_unlock_chord_task(app):
 def add_unlock_chord_task(app):
-    """The unlock chord task is used by result backends that doesn't
-    have native chord support.
+    """This task is used by result backends without native chord support.
 
 
-    It creates a task chain polling the header for completion.
+    It joins chords by creating a task chain polling the header for completion.
 
 
     """
     """
     from celery.canvas import subtask
     from celery.canvas import subtask

+ 6 - 6
celery/bootsteps.py

@@ -9,7 +9,6 @@
 from __future__ import absolute_import, unicode_literals
 from __future__ import absolute_import, unicode_literals
 
 
 from collections import deque
 from collections import deque
-from importlib import import_module
 from threading import Event
 from threading import Event
 
 
 from kombu.common import ignore_errors
 from kombu.common import ignore_errors
@@ -175,10 +174,14 @@ class Namespace(object):
         """Apply the steps in this namespace to an object.
         """Apply the steps in this namespace to an object.
 
 
         This will apply the ``__init__`` and ``include`` methods
         This will apply the ``__init__`` and ``include`` methods
-        of each steps with the object as argument.
+        of each step, with the object as argument::
+
+            step = Step(obj)
+            ...
+            step.include(obj)
 
 
         For :class:`StartStopStep` the services created
         For :class:`StartStopStep` the services created
-        will also be added the the objects ``steps`` attribute.
+        will also be added to the objects ``steps`` attribute.
 
 
         """
         """
         self._debug('Preparing bootsteps.')
         self._debug('Preparing bootsteps.')
@@ -200,9 +203,6 @@ class Namespace(object):
         self.graph.adjacent.update(other.graph.adjacent)
         self.graph.adjacent.update(other.graph.adjacent)
         self.graph.add_edge(type(other.order[0]), type(self.order[-1]))
         self.graph.add_edge(type(other.order[0]), type(self.order[-1]))
 
 
-    def import_module(self, module):
-        return import_module(module)
-
     def __getitem__(self, name):
     def __getitem__(self, name):
         return self.steps[name]
         return self.steps[name]
 
 

+ 1 - 1
celery/canvas.py

@@ -53,7 +53,7 @@ class _getitem_property(object):
         10
         10
 
 
         >>> me.deep_thing = 42
         >>> me.deep_thing = 42
-        >>> me.deep_thinge
+        >>> me.deep_thing
         42
         42
         >>> me.deep:
         >>> me.deep:
         defaultdict(<type 'dict'>, {'thing': 42})
         defaultdict(<type 'dict'>, {'thing': 42})

+ 0 - 5
celery/datastructures.py

@@ -155,11 +155,6 @@ class DependencyGraph(object):
         (``A`` depends on ``B``)."""
         (``A`` depends on ``B``)."""
         self[A].append(B)
         self[A].append(B)
 
 
-    def find_last(self, g):
-        for obj in g.adjacent:
-            if obj.last:
-                return obj
-
     def connect(self, graph):
     def connect(self, graph):
         """Add nodes from another graph."""
         """Add nodes from another graph."""
         self.adjacent.update(graph.adjacent)
         self.adjacent.update(graph.adjacent)

+ 4 - 4
celery/platforms.py

@@ -21,7 +21,7 @@ from kombu.utils.encoding import safe_str
 from contextlib import contextmanager
 from contextlib import contextmanager
 
 
 from .local import try_import
 from .local import try_import
-from .five import items, range, reraise, string_t
+from .five import items, range, reraise, string_t, int_types
 
 
 _setproctitle = try_import('setproctitle')
 _setproctitle = try_import('setproctitle')
 resource = try_import('resource')
 resource = try_import('resource')
@@ -258,7 +258,7 @@ def _create_pidlock(pidfile):
 
 
 
 
 def fileno(f):
 def fileno(f):
-    if isinstance(f, (int, long)):
+    if isinstance(f, int_types):
         return f
         return f
     return f.fileno()
     return f.fileno()
 
 
@@ -390,7 +390,7 @@ def parse_uid(uid):
     """Parse user id.
     """Parse user id.
 
 
     uid can be an integer (uid) or a string (user name), if a user name
     uid can be an integer (uid) or a string (user name), if a user name
-    the uid is taken from the password file.
+    the uid is taken from the system user registry.
 
 
     """
     """
     try:
     try:
@@ -406,7 +406,7 @@ def parse_gid(gid):
     """Parse group id.
     """Parse group id.
 
 
     gid can be an integer (gid) or a string (group name), if a group name
     gid can be an integer (gid) or a string (group name), if a group name
-    the gid is taken from the password file.
+    the gid is taken from the system group registry.
 
 
     """
     """
     try:
     try: