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
| Type | Description |
|---|---|
typing.Type | The 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
| Name | Type | Description |
|---|---|---|
| python_val | typing.Any | The Python value to be serialized and stored. |
Returns
| Type | Description |
|---|---|
str | The 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
| Name | Type | Description |
|---|---|---|
| uri | str | The URI of the pickle file to be deserialized. This can be a local path or a remote storage URI. |
Returns
| Type | Description |
|---|---|
typing.Any | The deserialized Python object from the pickle file. |