VolumeClient¶
- class baseten.sandbox.VolumeClient¶
Bases:
objectPersistent volumes, which keep their data beyond the sandboxes they are mounted in.
Mount one when creating a sandbox with its
volumesoption. Obtained fromSandboxClient.volumes.- Parameters:
context (VolumeClientContext)
- create(*, size, name=None, region=None, labels=None)¶
Create a volume.
The volume becomes ready asynchronously, so its status may still be deploying.
- Parameters:
size (str | int) – Capacity, as a size such as
"10Gi"or"512Mi", or a number of megabytes. It can grow later but never shrink.name (str | None) – Unique name of the volume. The server assigns one when
None.region (str | None) – Region of the volume. Defaults to the default sandbox region. Only sandboxes in the same region can mount it.
labels (Mapping[str, str] | None) – Key-value pairs for organizing and filtering.
- Return type:
- delete(*, name)¶
Delete a volume and its data. Fails while a sandbox mounts it.
Deletion continues after this returns, so the record usually shows the volume as deleting.
- Parameters:
name (str) – Name of the volume.
- Return type:
- get_info(*, name)¶
Get a volume’s current record.
- Parameters:
name (str) – Name of the volume.
- Return type:
- list(*, query=None, statuses=None, page_size=None)¶
List volumes, newest first, fetching further pages as iteration reaches them.
Records omit labels.
- update(*, name, size=None, labels=None)¶
Update a volume, returning its new record.
- Parameters:
name (str) – Name of the volume.
size (str | int | None) – New capacity, as a size such as
"20Gi"or a number of megabytes, no less than the current capacity.Noneleaves it unchanged.labels (Mapping[str, str] | None) – Labels replacing all current ones, including when empty.
Noneleaves them unchanged.
- Return type: