bundle.lambdalabs.client¶
Lambda Labs REST API client.
Attributes¶
Exceptions¶
Common base class for all non-exit exceptions. |
Classes¶
Async client for the Lambda Labs Cloud API v1. |
Module Contents¶
- bundle.lambdalabs.client.log¶
- bundle.lambdalabs.client.BASE_URL = 'https://cloud.lambdalabs.com/api/v1'¶
- bundle.lambdalabs.client.DEFAULT_POLL_INTERVAL = 10¶
- exception bundle.lambdalabs.client.LambdaApiError(status_code: int, message: str)¶
Bases:
ExceptionCommon base class for all non-exit exceptions.
- status_code¶
- class bundle.lambdalabs.client.LambdaClient(api_key: str)¶
Async client for the Lambda Labs Cloud API v1.
- Usage:
- async with LambdaClient(api_key=”…”) as client:
types = await client.instance_types() instance = await client.launch(“gpu_1x_a10”, ssh_key_names=[“mykey”]) await client.wait_active(instance.id) await client.terminate([instance.id])
- async instance_types() dict[str, bundle.lambdalabs.models.InstanceType]¶
Return available instance types keyed by name.
- async instances() list[bundle.lambdalabs.models.Instance]¶
Return all active instances.
- async get_instance(instance_id: str) bundle.lambdalabs.models.Instance¶
Return a single instance by ID.
- async filesystems() list[bundle.lambdalabs.models.Filesystem]¶
Return all filesystems in the account.
- async create_filesystem(name: str, region_name: str = 'us-east-1') bundle.lambdalabs.models.Filesystem¶
Create a persistent filesystem.
- async launch(instance_type_name: str, ssh_key_names: list[str], region_name: str = 'us-east-1', name: str | None = None, quantity: int = 1, file_system_names: list[str] | None = None) list[str]¶
Launch instances. Returns list of instance IDs.
- async terminate(instance_ids: list[str]) list[str]¶
Terminate instances. Returns list of terminated instance IDs.
- async ssh_keys() list[bundle.lambdalabs.models.SshKey]¶
Return all SSH keys in the account.
- async add_ssh_key(name: str, public_key: str) bundle.lambdalabs.models.SshKey¶
Add an SSH key to the account.
- async wait_active(instance_id: str, poll_interval: float = DEFAULT_POLL_INTERVAL, timeout: float = 600) bundle.lambdalabs.models.Instance¶
Poll until the instance is active with an IP. Raises TimeoutError on timeout.