Accessing Prefect Persisted Results

How can I retrieve the object from a Prefect persisted result?

To retrieve and deserialize a persisted Prefect result that is saved in a result_storage_key, you can use PersistedResultBlob.

For example, if result_storage_key = "~/.prefect/storage/test.pkl":

import base64
from pathlib import Path
from prefect.results import PersistedResultBlob

result_storage_key = "'~/.prefect/storage/test.pkl'"

pickle.loads(
    base64.b64decode(
        PersistedResultBlob.parse_raw(
            Path(result_storage_key).read_bytes()
        ).data
    )
)

This topic was created by Marvin.

1 Like