plumpy.mixins module#

class plumpy.mixins.ContextMixin(*args: Any, **kwargs: Any)[source]#

Bases: Savable

Add a context to a Process. The contents of the context will be saved in the instance state unlike standard instance variables.

CONTEXT: str = '_context'#
_context: AttributesDict | None#
property ctx: AttributesDict | None#
load_instance_state(saved_state: MutableMapping[str, Any], load_context: LoadSaveContext) None[source]#
save_instance_state(out_state: MutableMapping[str, Any], save_context: LoadSaveContext | None) None[source]#

Add the instance state to out_state. .. important:

The instance state will contain a pointer to the ``ctx``,
and so should be deep copied or serialised before persisting.