def obj_pxy_dask_deserialize(header, frames): """ The generic deserialization of ProxyObject. Notice, it doesn't deserialize the proxied object at this time. When accessed, the proxied object are deserialized using the same serializers that were used when the object was serialized. """ args = header["obj-pxy-detail"] if args["subclass"] is None: subclass = ProxyObject else: subclass = loads_function(args["subclass"]) return subclass(ProxyDetail(obj=(header["proxied-header"], frames), **args))
def __reduce__(self): """Serialization of ProxyObject that uses pickle""" self._obj_pxy_serialize(serializers=("pickle", )) args = self._obj_pxy_get_init_args() if args["subclass"]: subclass = loads_function(args["subclass"]) else: subclass = ProxyObject # Make sure the frames are all bytes header, frames = args["obj"] args["obj"] = (header, [bytes(f) for f in frames]) return (subclass, tuple(args.values()))
def __reduce__(self): """Serialization of ProxyObject that uses pickle""" pxy = self._pxy_get(copy=True) pxy.serialize(serializers=("pickle", )) if pxy.subclass: subclass = loads_function(pxy.subclass) else: subclass = ProxyObject # Make sure the frames are all bytes header, frames = pxy.obj pxy.obj = (header, [bytes(f) for f in frames]) self._pxy_set(pxy) return (subclass, (pxy, ))