Skip to main content

BaseCheckpoint

Base type for task checkpoint helpers. Subclasses load prior checkpoint data from prev_checkpoint into a local workspace and upload new state to checkpoint_path.

Attributes

AttributeTypeDescription
pathpathlib.PathLocal directory for reading and writing checkpoint files (your format).

Methods


path()

@classmethod
def path() - > pathlib.Path

Local directory for reading and writing checkpoint files (your format).

Returns

TypeDescription
pathlib.PathThe local filesystem path where checkpoint files are stored and managed

prev_exists()

@classmethod
def prev_exists() - > bool

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

Returns

TypeDescription
boolTrue if a previous checkpoint exists and is available for restoration, False otherwise

load()

@classmethod
def load() - > Optional[pathlib.Path]

Load checkpoint data from the remote source (async).

Returns

TypeDescription
Optional[pathlib.Path]The path to the loaded checkpoint directory, or None if no checkpoint was found

save()

@classmethod
def save(
data: pathlib.Path | str | bytes
) - > None

Save checkpoint data to the remote destination (async).

Parameters

NameTypeDescription
data`pathlib.Pathstr

Returns

TypeDescription
NoneNothing is returned

load_sync()

@classmethod
def load_sync() - > Optional[pathlib.Path]

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

Returns

TypeDescription
Optional[pathlib.Path]The path to the loaded checkpoint directory, or None if no checkpoint was found

save_sync()

@classmethod
def save_sync(
data: pathlib.Path | str | bytes
) - > None

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

Parameters

NameTypeDescription
data`pathlib.Pathstr

Returns

TypeDescription
NoneNothing is returned