Browse Source

Add :setting: ref to all settings in docstrings

Ask Solem 14 years ago
parent
commit
c4ee30b521

+ 1 - 1
celery/backends/cassandra.py

@@ -47,7 +47,7 @@ class CassandraBackend(BaseDictBackend):
         """Initialize Cassandra backend.
 
         Raises :class:`celery.exceptions.ImproperlyConfigured` if
-        the ``CASSANDRA_SERVERS`` setting is not set.
+        the :setting:`CASSANDRA_SERVERS` setting is not set.
 
         """
         self.logger = setup_logger("celery.backends.cassandra")

+ 1 - 1
celery/backends/pyredis.py

@@ -28,7 +28,7 @@ class RedisBackend(KeyValueStoreBackend):
         The port to the Redis server.
 
         Raises :class:`celery.exceptions.ImproperlyConfigured` if
-        the ``REDIS_HOST`` or ``REDIS_PORT`` settings is not set.
+        the :setting:`REDIS_HOST` or :setting:`REDIS_PORT` settings is not set.
 
     """
     redis_host = "localhost"

+ 3 - 3
celery/execute/__init__.py

@@ -74,13 +74,13 @@ def apply_async(task, args=None, kwargs=None, countdown=None, eta=None,
       Defaults to the tasks :attr:`~celery.task.base.Task.priority` attribute.
 
     :keyword serializer: A string identifying the default serialization
-      method to use. Defaults to the ``CELERY_TASK_SERIALIZER`` setting.
+      method to use. Defaults to the :setting:`CELERY_TASK_SERIALIZER` setting.
       Can be ``pickle`` ``json``, ``yaml``, or any custom serialization
       methods that have been registered with
       :mod:`carrot.serialization.registry`. Defaults to the tasks
       :attr:`~celery.task.base.Task.serializer` attribute.
 
-    **Note**: If the ``CELERY_ALWAYS_EAGER`` setting is set, it will be
+    **Note**: If the :setting:`CELERY_ALWAYS_EAGER` setting is set, it will be
     replaced by a local :func:`apply` call instead.
 
     """
@@ -166,7 +166,7 @@ def apply(task, args, kwargs, **options):
     """Apply the task locally.
 
     :keyword throw: Re-raise task exceptions. Defaults to
-        the ``CELERY_EAGER_PROPAGATES_EXCEPTIONS`` setting.
+        the :setting:`CELERY_EAGER_PROPAGATES_EXCEPTIONS` setting.
 
     This will block until the task completes, and returns a
     :class:`celery.result.EagerResult` instance.

+ 2 - 2
celery/loaders/default.py

@@ -69,8 +69,8 @@ class Loader(BaseLoader):
         """Imports modules at worker init so tasks can be registered
         and used by the worked.
 
-        The list of modules to import is taken from the ``CELERY_IMPORTS``
-        setting in ``celeryconf.py``.
+        The list of modules to import is taken from the
+        :setting:`CELERY_IMPORTS` setting.
 
         """
         self.import_default_modules()

+ 1 - 1
celery/messaging.py

@@ -297,7 +297,7 @@ def get_consumer_set(connection, queues=None, **options):
     """Get the :class:`carrot.messaging.ConsumerSet`` for a queue
     configuration.
 
-    Defaults to the queues in ``CELERY_QUEUES``.
+    Defaults to the queues in :const:`CELERY_QUEUES`.
 
     """
     queues = queues or conf.get_queues()

+ 16 - 14
celery/result.py

@@ -55,8 +55,9 @@ class BaseAsyncResult(object):
         :keyword timeout: How long to wait, in seconds, before the
             operation times out.
 
-        :raises celery.exceptions.TimeoutError: if ``timeout`` is not ``None``
-            and the result does not arrive within ``timeout`` seconds.
+        :raises celery.exceptions.TimeoutError: if ``timeout`` is not
+            :const:`None` and the result does not arrive within ``timeout``
+            seconds.
 
         If the remote call raised an exception then that
         exception will be re-raised.
@@ -69,21 +70,21 @@ class BaseAsyncResult(object):
         return self.wait(timeout=timeout)
 
     def ready(self):
-        """Returns ``True`` if the task executed successfully, or raised
+        """Returns :const:`True` if the task executed successfully, or raised
         an exception.
 
         If the task is still running, pending, or is waiting
-        for retry then ``False`` is returned.
+        for retry then :const:`False` is returned.
 
         """
         return self.status not in self.backend.UNREADY_STATES
 
     def successful(self):
-        """Returns ``True`` if the task executed successfully."""
+        """Returns :const:`True` if the task executed successfully."""
         return self.status == states.SUCCESS
 
     def failed(self):
-        """Returns ``True`` if the task failed by exception."""
+        """Returns :const:`True` if the task failed by exception."""
         return self.status == states.FAILURE
 
     def __str__(self):
@@ -208,7 +209,7 @@ class TaskSetResult(object):
     def successful(self):
         """Was the taskset successful?
 
-        :returns: ``True`` if all of the tasks in the taskset finished
+        :returns: :const:`True` if all of the tasks in the taskset finished
             successfully (i.e. did not raise an exception).
 
         """
@@ -218,7 +219,7 @@ class TaskSetResult(object):
     def failed(self):
         """Did the taskset fail?
 
-        :returns: ``True`` if any of the tasks in the taskset failed.
+        :returns: :const:`True` if any of the tasks in the taskset failed.
             (i.e., raised an exception)
 
         """
@@ -228,7 +229,7 @@ class TaskSetResult(object):
     def waiting(self):
         """Is the taskset waiting?
 
-        :returns: ``True`` if any of the tasks in the taskset is still
+        :returns: :const:`True` if any of the tasks in the taskset is still
             waiting for execution.
 
         """
@@ -238,7 +239,7 @@ class TaskSetResult(object):
     def ready(self):
         """Is the task ready?
 
-        :returns: ``True`` if all of the tasks in the taskset has been
+        :returns: :const:`True` if all of the tasks in the taskset has been
             executed.
 
         """
@@ -302,8 +303,9 @@ class TaskSetResult(object):
         :keyword timeout: The time in seconds, how long
             it will wait for results, before the operation times out.
 
-        :raises celery.exceptions.TimeoutError: if ``timeout`` is not ``None``
-            and the operation takes longer than ``timeout`` seconds.
+        :raises celery.exceptions.TimeoutError: if ``timeout`` is not
+            :const:`None` and the operation takes longer than ``timeout``
+            seconds.
 
         If any of the tasks raises an exception, the exception
         will be reraised by :meth:`join`.
@@ -367,11 +369,11 @@ class EagerResult(BaseAsyncResult):
         self._traceback = traceback
 
     def successful(self):
-        """Returns ``True`` if the task executed without failure."""
+        """Returns :const:`True` if the task executed without failure."""
         return self.status == states.SUCCESS
 
     def ready(self):
-        """Returns ``True`` if the task has been executed."""
+        """Returns :const:`True` if the task has been executed."""
         return True
 
     def wait(self, timeout=None):

+ 1 - 1
celery/serialization.py

@@ -55,7 +55,7 @@ def find_nearest_pickleable_exception(exc):
     :param exc: An exception instance.
 
     :returns: the nearest exception if it's not :exc:`Exception` or below,
-        if it is it returns ``None``.
+        if it is it returns :const:`None`.
 
     :rtype :exc:`Exception`:
 

+ 22 - 21
celery/task/base.py

@@ -89,7 +89,7 @@ class Task(object):
 
     .. attribute:: abstract
 
-        If ``True`` the task is an abstract base class.
+        If :const:`True` the task is an abstract base class.
 
     .. attribute:: type
 
@@ -100,7 +100,7 @@ class Task(object):
     .. attribute:: queue
 
         Select a destination queue for this task. The queue needs to exist
-        in ``CELERY_QUEUES``. The ``routing_key``, ``exchange`` and
+        in :setting:`CELERY_QUEUES`. The ``routing_key``, ``exchange`` and
         ``exchange_type`` attributes will be ignored if this is set.
 
     .. attribute:: routing_key
@@ -140,7 +140,7 @@ class Task(object):
     .. attribute:: max_retries
 
         Maximum number of retries before giving up.
-        If set to ``None``, it will never stop retrying.
+        If set to :const:`None`, it will never stop retrying.
 
     .. attribute:: default_retry_delay
 
@@ -149,9 +149,9 @@ class Task(object):
 
     .. attribute:: rate_limit
 
-        Set the rate limit for this task type, Examples: ``None`` (no rate
-        limit), ``"100/s"`` (hundred tasks a second), ``"100/m"`` (hundred
-        tasks a minute), ``"100/h"`` (hundred tasks an hour)
+        Set the rate limit for this task type, Examples: :const:`None` (no
+        rate limit), ``"100/s"`` (hundred tasks a second), ``"100/m"``
+        (hundred tasks a minute), ``"100/h"`` (hundred tasks an hour)
 
     .. attribute:: ignore_result
 
@@ -182,12 +182,12 @@ class Task(object):
 
     .. attribute:: autoregister
 
-        If ``True`` the task is automatically registered in the task
+        If :const:`True` the task is automatically registered in the task
         registry, which is the default behaviour.
 
     .. attribute:: track_started
 
-        If ``True`` the task will report its status as "started"
+        If :const:`True` the task will report its status as "started"
         when the task is executed by a worker.
         The default value is ``False`` as the normal behaviour is to not
         report that level of granularity. Tasks are either pending, finished,
@@ -195,12 +195,12 @@ class Task(object):
         when there are long running tasks and there is a need to report which
         task is currently running.
 
-        The global default can be overridden by the ``CELERY_TRACK_STARTED``
-        setting.
+        The global default can be overridden by the
+        :setting:`CELERY_TRACK_STARTED` setting.
 
     .. attribute:: acks_late
 
-        If set to ``True`` messages for this task will be acknowledged
+        If set to :vonst:`True` messages for this task will be acknowledged
         **after** the task has been executed, not *just before*, which is
         the default behavior.
 
@@ -208,7 +208,7 @@ class Task(object):
         crashes in the middle of execution, which may be acceptable for some
         applications.
 
-        The global default can be overriden by the ``CELERY_ACKS_LATE``
+        The global default can be overriden by the :setting:`CELERY_ACKS_LATE`
         setting.
 
     """
@@ -443,7 +443,7 @@ class Task(object):
         :param args: positional arguments passed on to the task.
         :param kwargs: keyword arguments passed on to the task.
         :keyword throw: Re-raise task exceptions. Defaults to
-            the ``CELERY_EAGER_PROPAGATES_EXCEPTIONS`` setting.
+            the :setting:`CELERY_EAGER_PROPAGATES_EXCEPTIONS` setting.
 
         :rtype :class:`celery.result.EagerResult`:
 
@@ -584,7 +584,7 @@ class PeriodicTask(Task):
 
     .. attribute:: relative
 
-        If set to ``True``, run times are relative to the time when the
+        If set to :const:`True`, run times are relative to the time when the
         server was started. This was the previous behaviour, periodic tasks
         are now scheduled by the clock.
 
@@ -674,13 +674,14 @@ class PeriodicTask(Task):
         * ``(False, 12)``, means the task should be run in 12 seconds.
 
         You can override this to decide the interval at runtime,
-        but keep in mind the value of ``CELERYBEAT_MAX_LOOP_INTERVAL``, which
-        decides the maximum number of seconds celerybeat can sleep between
-        re-checking the periodic task intervals. So if you dynamically change
-        the next run at value, and the max interval is set to 5 minutes, it
-        will take 5 minutes for the change to take effect, so you may
-        consider lowering the value of ``CELERYBEAT_MAX_LOOP_INTERVAL`` if
-        responsiveness if of importance to you.
+        but keep in mind the value of :setting:`CELERYBEAT_MAX_LOOP_INTERVAL`,
+        which decides the maximum number of seconds celerybeat can sleep
+        between re-checking the periodic task intervals.  So if you
+        dynamically change the next run at value, and the max interval is
+        set to 5 minutes, it will take 5 minutes for the change to take
+        effect, so you may consider lowering the value of
+        :setting:`CELERYBEAT_MAX_LOOP_INTERVAL` if responsiveness is of
+        importance to you.
 
         """
         return self.run_every.is_due(last_run_at)

+ 4 - 4
celery/utils/__init__.py

@@ -129,7 +129,7 @@ def kwdict(kwargs):
 
 def first(predicate, iterable):
     """Returns the first element in ``iterable`` that ``predicate`` returns a
-    ``True`` value for."""
+    :const:`True` value for."""
     for item in iterable:
         if predicate(item):
             return item
@@ -214,13 +214,13 @@ def is_iterable(obj):
 
 
 def mitemgetter(*items):
-    """Like :func:`operator.itemgetter` but returns ``None`` on missing items
-    instead of raising :exc:`KeyError`."""
+    """Like :func:`operator.itemgetter` but returns :const:`None`
+    on missing items instead of raising :exc:`KeyError`."""
     return lambda container: map(container.get, items)
 
 
 def mattrgetter(*attrs):
-    """Like :func:`operator.itemgetter` but returns ``None`` on missing
+    """Like :func:`operator.itemgetter` but returns :const:`None` on missing
     attributes instead of raising :exc:`AttributeError`."""
     return lambda obj: dict((attr, getattr(obj, attr, None))
                                 for attr in attrs)

+ 4 - 4
celery/utils/dispatch/signal.py

@@ -45,8 +45,8 @@ class Signal(object):
         :param receiver: A function or an instance method which is to
             receive signals. Receivers must be hashable objects.
 
-            if weak is ``True``, then receiver must be weak-referencable (more
-            precisely :func:`saferef.safe_ref()` must be able to create a
+            if weak is :const:`True`, then receiver must be weak-referencable
+            (more precisely :func:`saferef.safe_ref()` must be able to create a
             reference to the receiver).
 
             Receivers must be able to accept keyword arguments.
@@ -56,7 +56,7 @@ class Signal(object):
             ``dispatch_uid``.
 
         :keyword sender: The sender to which the receiver should respond.
-            Must either be of type :class:`Signal`, or ``None`` to receive
+            Must either be of type :class:`Signal`, or :const:`None` to receive
             events from any sender.
 
         :keyword weak: Whether to use weak references to the receiver.
@@ -121,7 +121,7 @@ class Signal(object):
         have all receivers called if a raises an error.
 
         :param sender: The sender of the signal. Either a specific
-            object or ``None``.
+            object or :const:`None`.
 
         :keyword \*\*named: Named arguments which will be passed to receivers.
 

+ 1 - 1
celery/utils/timeutils.py

@@ -55,7 +55,7 @@ def remaining(start, ends_in, now=None, relative=True):
 
     :param start: Start :class:`~datetime.datetime`.
     :param ends_in: The end delta as a :class:`~datetime.timedelta`.
-    :keyword relative: If set to ``False``, the end time will be calculated
+    :keyword relative: If set to :const:`False`, the end time will be calculated
         using :func:`delta_resolution` (i.e. rounded to the resolution
           of ``ends_in``).
     :keyword now: The current time, defaults to :func:`datetime.now`.

+ 1 - 1
celery/worker/__init__.py

@@ -74,7 +74,7 @@ class WorkController(object):
 
     .. attribute:: embed_clockservice
 
-        If ``True``, celerybeat is embedded, running in the main worker
+        If :const:`True`, celerybeat is embedded, running in the main worker
         process as a thread.
 
     .. attribute:: send_events

+ 2 - 2
celery/worker/job.py

@@ -181,7 +181,7 @@ class TaskRequest(object):
 
     .. attribute:: executed
 
-        Set to ``True`` if the task has been executed.
+        Set to :const:`True` if the task has been executed.
         A task should only be executed once.
 
     .. attribute:: delivery_info
@@ -191,7 +191,7 @@ class TaskRequest(object):
 
     .. attribute:: acknowledged
 
-        Set to ``True`` if the task has been acknowledged.
+        Set to :const:`True` if the task has been acknowledged.
 
     """
     # Logging output