Checkpoint helper using flyte.io.File for all checkpoint blob I/O (load/save, async and sync).
Remote paths are a single object.
Attributes
| Attribute | Type | Description |
|---|
| remote_destination | str | Object-store prefix where flyte.Checkpoint.save writes. |
| remote_source | `str | None` |
| path | pathlib.Path | Local directory for reading checkpoint files. |
Constructor
Signature
def Checkpoint(
checkpoint_dest: str,
checkpoint_src: str | None = None
) - > null
Parameters
| Name | Type | Description |
|---|
| checkpoint_dest | str | The remote object-store prefix where the checkpoint will be saved. |
| checkpoint_src | `str | None` = None |
Methods
remote_destination()
@classmethod
def remote_destination() - > str
Object-store prefix where flyte.Checkpoint.save writes.
Returns
| Type | Description |
|---|
str | The remote URI where the checkpoint will be uploaded. |
remote_source()
@classmethod
def remote_source() - > Optional[str]
Object-store prefix for the previous attempt's checkpoint, if any.
Returns
| Type | Description |
|---|
Optional[str] | The remote URI of the previous checkpoint, or None if no source exists. |
path()
@classmethod
def path() - > pathlib.Path
Local directory for reading checkpoint files.
Returns
| Type | Description |
|---|
pathlib.Path | The local filesystem path to the temporary directory where checkpoints are managed. |
prev_exists()
@classmethod
def prev_exists() - > bool
Checks if a remote source URI is available for restoration.
Returns
| Type | Description |
|---|
bool | True if a previous checkpoint source is defined, False otherwise. |
load()
@classmethod
def load() - > Optional[pathlib.Path]
Asynchronously downloads and restores the previous checkpoint from the remote source.
Returns
| Type | Description |
|---|
Optional[pathlib.Path] | The local path to the restored checkpoint data, or None if no checkpoint exists. |
load_sync()
@classmethod
def load_sync() - > Optional[pathlib.Path]
Synchronously downloads and restores the previous checkpoint from the remote source.
Returns
| Type | Description |
|---|
Optional[pathlib.Path] | The local path to the restored checkpoint data, or None if no checkpoint exists. |
save()
@classmethod
def save(
data: pathlib.Path | str | bytes
) - > None
Asynchronously saves the provided data (path, string path, or bytes) as a checkpoint.
Parameters
| Name | Type | Description |
|---|
| data | `pathlib.Path | str |
Returns
save_sync()
@classmethod
def save_sync(
data: pathlib.Path | str | bytes
) - > None
Synchronously saves the provided data (path, string path, or bytes) as a checkpoint.
Parameters
| Name | Type | Description |
|---|
| data | `pathlib.Path | str |
Returns