air_sdk.endpoints.checkpoints

View as Markdown

Classes

NameDescription
CheckpointCheckpoint model representing a snapshot of a simulation run.
CheckpointEndpointAPIEndpoint API for managing simulation checkpoints.

Module Contents

class air_sdk.endpoints.checkpoints.Checkpoint

Bases: air_sdk.air_model.AirModel

Checkpoint model representing a snapshot of a simulation run.

Checkpoints are created when a simulation is shut down (stored). They capture the state of all nodes at that point in time and can be used to restore the simulation to that state later.

id: str

Unique identifier for the checkpoint

name: str

A customizable name for the checkpoint

favorite: bool

Whether the checkpoint is favored over others when Air determines which checkpoints should be automatically deleted

Timestamp when the checkpoint was created

Timestamp when the checkpoint was last modified

run: str

UUID of the run during which the checkpoint was created

state: Literal[PENDING, COMPLETE, DELETED]

Current state of the checkpoint (PENDING, COMPLETE, or DELETED)

get_model_api() -> type[CheckpointEndpointAPI]
update(
*,
name: str = ...,
favorite: bool = ...,
**kwargs: Any
) -> None

Update the checkpoint’s properties.

Parameters:

  • name – A new name for the checkpoint
  • favorite – Whether the checkpoint should be protected from automatic deletion
  • **kwargs – Additional fields for future API compatibility

Example:

>>> checkpoint.update(name='Before upgrade', favorite=True)
delete() -> None

Delete this checkpoint.

Only checkpoints in the COMPLETE state may be deleted. Deletion updates the state to DELETED and removes the stored snapshots.

Example:

>>> checkpoint.delete()
class air_sdk.endpoints.checkpoints.CheckpointEndpointAPI

Bases: air_sdk.air_model.BaseEndpointAPI[air_sdk.endpoints.checkpoints.Checkpoint]

Endpoint API for managing simulation checkpoints.

Provides methods for listing, retrieving, updating, and deleting checkpoints. Checkpoints cannot be created directly; they are created automatically when a simulation is shut down.

API_PATH: str
list(
*,
simulation: str | PrimaryKey = ...,
run: str | PrimaryKey = ...,
state: Literal[PENDING, COMPLETE, DELETED] = ...,
favorite: bool = ...,
limit: int = ...,
offset: int = ...,
ordering: str = ...,
search: str = ...,
**kwargs: Any

List checkpoints.

When accessed via simulation.checkpoints.list(), results are automatically filtered to that simulation. When accessed via api.checkpoints.list(), all visible checkpoints are returned unless filtered.

Parameters:

  • simulation – Filter by simulation UUID
  • run – Filter by run UUID
  • state – Filter by checkpoint state
  • favorite – Filter by favorite status
  • limit – Number of results to return per page
  • offset – Initial index from which to return results
  • ordering – Order by field (prefix with ”-” for descending). Options: created, modified, name, run, state, favorite
  • search – Search by name or state
  • **kwargs – Additional filter parameters

Returns:

Iterator of Checkpoint instances

Example:

>>> for cp in api.checkpoints.list(
... simulation='sim-id', state='COMPLETE'
... ):
... print(cp.name)
get(
pk: PrimaryKey,
**kwargs: Any

Retrieve a specific checkpoint.

Parameters:

  • pk – Checkpoint UUID
  • **kwargs – Additional query parameters

Returns:

Checkpoint instance

Example:

>>> checkpoint = api.checkpoints.get('checkpoint-uuid')
>>> print(checkpoint.name, checkpoint.state)
patch(
pk: PrimaryKey,
*,
name: str = ...,
favorite: bool = ...,
**kwargs: Any

Update individual fields of a checkpoint.

Only name and favorite can be modified.

Parameters:

  • pk – Checkpoint UUID
  • name – A new name for the checkpoint
  • favorite – Whether the checkpoint should be protected from automatic deletion
  • **kwargs – Additional fields for future API compatibility

Returns:

Updated Checkpoint instance

Example:

>>> checkpoint = api.checkpoints.patch( # fmt: skip
... 'checkpoint-uuid', name='Pre-upgrade snapshot'
... )
delete(
pk: PrimaryKey,
**kwargs: Any
) -> None

Delete a checkpoint.

Only checkpoints in the COMPLETE state may be deleted. Deletion updates the state to DELETED and removes the stored snapshots.

Parameters:

  • pk – Checkpoint UUID
  • **kwargs – Additional parameters

Example:

>>> api.checkpoints.delete('checkpoint-uuid')
update(
*,
checkpoint: Checkpoint | PrimaryKey,
name: str = ...,
favorite: bool = ...,
**kwargs: Any

Update individual fields of a checkpoint.

Only name and favorite can be modified.

Parameters:

  • checkpoint – Checkpoint instance or checkpoint UUID
  • name – A new name for the checkpoint
  • favorite – Whether the checkpoint should be protected from automatic deletion
  • **kwargs – Additional fields for future API compatibility

Returns:

Updated Checkpoint instance

Example:

>>> cp = api.checkpoints.get('checkpoint-uuid')
>>> api.checkpoints.update(checkpoint=cp, name='Renamed', favorite=True)