2.1.5

Checkpoint

Package: flyte

Checkpoint helper using flyte.io.File for all checkpoint blob I/O (load/save, async and sync). Remote paths are a single object.

In async tasks use flyte.Checkpoint.load and flyte.Checkpoint.save. In ordinary def tasks use flyte.Checkpoint.load_sync and flyte.Checkpoint.save_sync.

Saving a directory uploads a gzip tar of its top-level entries; saving a file or bytes uploads that payload directly. After flyte.Checkpoint.load / flyte.Checkpoint.load_sync, a non-tar remote object appears as path / "payload" and those methods return that path. Tarball checkpoints unpack under flyte.Checkpoint.path; they return flyte.Checkpoint.path so callers can scan the restored tree (e.g. pathlib.Path.rglob).

Parameters

class Checkpoint(
    checkpoint_dest: str,
    checkpoint_src: str | None,
)
Parameter Type Description
checkpoint_dest str
checkpoint_src str | None

Properties

Property Type Description
path None Local directory for reading checkpoint files.
remote_destination None Object-store prefix where flyte.Checkpoint.save writes.
remote_source None Object-store prefix for the previous attempt’s checkpoint, if any.

Methods

Method Description
load() Load checkpoint data from the remote source (async).
load_sync() Load checkpoint data from the remote source (sync task code).
prev_exists() Whether the runtime provided a previous-checkpoint prefix (retry / resume).
save() Save checkpoint data to the remote destination (async).
save_sync() Save checkpoint data to the remote destination (sync task code).

load()

def load()

Load checkpoint data from the remote source (async).

load_sync()

def load_sync()

Load checkpoint data from the remote source (sync task code).

prev_exists()

def prev_exists()

Whether the runtime provided a previous-checkpoint prefix (retry / resume).

save()

def save(
    data: pathlib.Path | str | bytes,
)

Save checkpoint data to the remote destination (async).

Parameter Type Description
data pathlib.Path | str | bytes

save_sync()

def save_sync(
    data: pathlib.Path | str | bytes,
)

Save checkpoint data to the remote destination (sync task code).

Parameter Type Description
data pathlib.Path | str | bytes