This document describes an older version of Celery (2.1). For the latest stable version please go here.

Serialization Tools - celery.serialization

exception celery.serialization.UnpickleableExceptionWrapper(exc_module, exc_cls_name, exc_args)

Wraps unpickleable exceptions.

Parameters:
exc_module

The module of the original exception.

exc_cls_name

The name of the original exception class.

exc_args

The arguments for the original exception.

Example

>>> try:
...     something_raising_unpickleable_exc()
>>> except Exception, e:
...     exc = UnpickleableException(e.__class__.__module__,
...                                 e.__class__.__name__,
...                                 e.args)
...     pickle.dumps(exc) # Works fine.
classmethod from_exception(exc)
restore()
celery.serialization.create_exception_cls(name, module, parent=None)

Dynamically create an exception class.

celery.serialization.find_nearest_pickleable_exception(exc)

With an exception instance, iterate over its super classes (by mro) and find the first super exception that is pickleable. It does not go below Exception (i.e. it skips Exception, BaseException and object). If that happens you should use UnpickleableException instead.

Parameters:exc – An exception instance.
Returns:the nearest exception if it’s not Exception or below, if it is it returns None.

:rtype Exception:

celery.serialization.get_pickleable_exception(exc)

Make sure exception is pickleable.

celery.serialization.get_pickled_exception(exc)

Get original exception from exception pickled using get_pickleable_exception().

celery.serialization.subclass_exception(name, parent, module)

Previous topic

Tracing Execution - celery.execute.trace

Next topic

Datastructures - celery.datastructures

This Page