Skip to main content

FlytePickle

This type is only used by flytekit internally. User should not use this type. Any type that flyte can't recognize will become FlytePickle

Methods


python_type()

@classmethod
def python_type() - > typing.Type

Returns the Python type associated with this FlytePickle instance. For a generic FlytePickle, it returns None.

Returns

TypeDescription
typing.TypeThe Python type represented by this FlytePickle.

to_pickle()

@classmethod
def to_pickle(
python_val: typing.Any
) - > str

Serializes a Python value into a pickle file and uploads it to storage, returning its URI. This method is used to store Python objects that Flyte cannot natively recognize.

Parameters

NameTypeDescription
python_valtyping.AnyThe Python value to be serialized and stored.

Returns

TypeDescription
strThe URI of the uploaded pickle file in storage.

from_pickle()

@classmethod
def from_pickle(
uri: str
) - > typing.Any

Deserializes a Python value from a pickle file located at the given URI. If the file is remote, it is first downloaded to a local path.

Parameters

NameTypeDescription
uristrThe URI of the pickle file to be deserialized. This can be a local path or a remote storage URI.

Returns

TypeDescription
typing.AnyThe deserialized Python object from the pickle file.