This document describes Celery 2.4. For development docs, go here.
celery.utils.serialization¶
celery.utils.serialization¶
Utilities for safely pickling exceptions.
copyright: |
|
---|---|
license: | BSD, see LICENSE for more details. |
-
exception
celery.utils.serialization.
UnpickleableExceptionWrapper
(exc_module, exc_cls_name, exc_args, text=None)¶ Wraps unpickleable exceptions.
Parameters: - exc_module – see
exc_module
. - exc_cls_name – see
exc_cls_name
. - exc_args – see
exc_args
Example
>>> try: ... something_raising_unpickleable_exc() >>> except Exception, e: ... exc = UnpickleableException(e.__class__.__module__, ... e.__class__.__name__, ... e.args) ... pickle.dumps(exc) # Works fine.
-
exc_args
= None¶ The arguments for the original exception.
-
exc_cls_name
= None¶ The name of the original exception class.
-
exc_module
= None¶ The module of the original exception.
-
classmethod
from_exception
(exc)¶
-
restore
()¶
- exc_module – see
-
celery.utils.serialization.
create_exception_cls
(name, module, parent=None)¶ Dynamically create an exception class.
-
celery.utils.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 skipsException
,BaseException
andobject
). If that happens you should useUnpickleableException
instead.Parameters: exc – An exception instance. Returns: the nearest exception if it’s not Exception
or below, if it is it returnsNone
.:rtype
Exception
:
-
celery.utils.serialization.
get_pickleable_exception
(exc)¶ Make sure exception is pickleable.
-
celery.utils.serialization.
get_pickled_exception
(exc)¶ Get original exception from exception pickled using
get_pickleable_exception()
.
-
celery.utils.serialization.
subclass_exception
(name, parent, module)¶
-
celery.utils.serialization.
unwanted_base_classes
= (<type 'exceptions.StandardError'>, <type 'exceptions.Exception'>, <type 'exceptions.BaseException'>, <type 'object'>)¶ List of base classes we probably don’t want to reduce to.