This document describes the current stable version of Celery (3.1). For development docs, go here.



Utility functions.


Return kombu.Queue that is a direct route to a worker by hostname.

Parameters:hostname – The fully qualified node name of a worker (e.g. If passed a kombu.Queue instance it will simply return that instead.
celery.utils.warn_deprecated(description=None, deprecation=None, removal=None, alternative=None, stacklevel=2)[source]
celery.utils.deprecated(deprecation=None, removal=None, alternative=None, description=None)[source]

Decorator for deprecated functions.

A deprecation warning will be emitted when the function is called.

  • deprecation – Version that marks first deprecation, if this argument is not set a PendingDeprecationWarning will be emitted instead.
  • removal – Future version when this feature will be removed.
  • alternative – Instructions for an alternative solution (if any).
  • description – Description of what is being deprecated.
celery.utils.lpmerge(L, R)[source]

In place left precedent dictionary merge.

Keeps values from L, if the value in R is None.

celery.utils.cry(out=None, sepchr='=', seplen=49)[source]

Return stacktrace of all active threads, taken from


Re-raise if an exception is currently being handled, or return otherwise.

celery.utils.strtobool(term, table={'1': True, '0': False, 'false': False, 'no': False, 'off': False, 'yes': True, 'on': True, 'true': True})[source]

Convert common terms for true/false to bool (true/false/yes/no/on/off/1/0).

celery.utils.jsonify(obj, builtin_types=(<class 'numbers.Real'>, <type 'basestring'>), key=None, keyfilter=None, unknown_type_filter=None)[source]

Transforms object making it suitable for json serialization

celery.utils.gen_task_name(app, name, module_name)[source]

Generate task name from name/module pair.

celery.utils.nodename(name, hostname)[source]

Create node name from name/hostname pair.


Split node name into tuple of name/hostname.

class celery.utils.cached_property(fget=None, fset=None, fdel=None, doc=None)

Property descriptor that caches the return value of the get function.


def connection(self):
    return Connection()

@connection.setter  # Prepares stored value
def connection(self, value):
    if value is None:
        raise TypeError('Connection must be a connection')
    return value

def connection(self, value):
    # Additional action to do at del(self.attr)
    if value is not None:
        print('Connection {0!r} deleted'.format(value)

Previous topic


Next topic


This Page