air_sdk.endpoints.checkpoints#
Classes#
Checkpoint model representing a snapshot of a simulation run. |
|
Endpoint API for managing simulation checkpoints. |
Module Contents#
- class air_sdk.endpoints.checkpoints.Checkpoint[source]#
Bases:
air_sdk.air_model.AirModelCheckpoint 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#
Unique identifier for the checkpoint
- name#
A customizable name for the checkpoint
- created#
Timestamp when the checkpoint was created
- modified#
Timestamp when the checkpoint was last modified
- run#
UUID of the run during which the checkpoint was created
- state#
Current state of the checkpoint (PENDING, COMPLETE, or DELETED)
- favorite#
Whether the checkpoint is favored over others when Air determines which checkpoints should be automatically deleted
- created: datetime.datetime#
- modified: datetime.datetime#
- state: Literal['PENDING', 'COMPLETE', 'DELETED']#
- classmethod get_model_api() type[CheckpointEndpointAPI][source]#
Returns the respective AirModelAPI type for this model.
- update( ) None[source]#
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)
- class air_sdk.endpoints.checkpoints.CheckpointEndpointAPI( )[source]#
Bases:
air_sdk.air_model.BaseEndpointAPI[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.
- model: type[Checkpoint]#
- list(
- *,
- simulation: str | air_sdk.air_model.PrimaryKey = ...,
- run: str | air_sdk.air_model.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 viaapi.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: air_sdk.air_model.PrimaryKey, **kwargs: Any) Checkpoint#
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( ) Checkpoint#
Update individual fields of a checkpoint.
Only
nameandfavoritecan 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: air_sdk.air_model.PrimaryKey, **kwargs: Any) None#
Delete a checkpoint.
Only checkpoints in the
COMPLETEstate may be deleted. Deletion updates the state toDELETEDand removes the stored snapshots.- Parameters:
pk – Checkpoint UUID
**kwargs – Additional parameters
Example
>>> api.checkpoints.delete('checkpoint-uuid')
- update(
- *,
- checkpoint: Checkpoint | air_sdk.air_model.PrimaryKey,
- name: str = ...,
- favorite: bool = ...,
- **kwargs: Any,
Update individual fields of a checkpoint.
Only
nameandfavoritecan 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)