create_storage

vessl.storage.create_storage(
    name: str,
    storage_type: vessl.storage.StorageType,
    path: str,
    credential_name: Optional[str],
    cluster_name: Optional[str],
)

Create an external storage.

VESSL External Storage acts as a bridge to external storage services (e.g., S3, GCS, etc.). Make sure to configure the external storage settings before proceeding.

If you do not want to use external storage, you can use the default VESSL storage, vessl-storage.

Args

  • name (str) : The name of the storage to create.
  • storage_type (StorageType) : The type of storage to create. Options: StorageType.S3, StorageType.GCS, StorageType.NFS, StorageType.HOST_PATH
  • path (str) : The path of the storage.
    • For s3 : Path must in {bucket_name}/{path} (e.g. my-bucket)
    • For gcs : Path must in {bucket_name}/{path} (e.g. my-bucket)
    • For nfs : Path must be in {server}:{path} format (e.g. 192.168.1.100:/shared/data)
    • For host-path : Path must be an absolute local path (e.g. /data/host-folder)
  • credential_name (str) : The name of the credential to use. Required if storage_type is S3 or GCS
  • cluster_name (str) : The name of the cluster to use. Required if storage_type is NFS or HOST_PATH

Examples

  • Create an S3 storage:
    vessl.storage.create_storage(
        name="my-s3-storage",
        storage_type=vessl.storage.StorageType.S3,
        path="my-bucket",
        credential_name="my-aws-credential",
    )
    
  • Create a GCS(Google Cloud Storage) storage:
    vessl.storage.create_storage(
        name="my-gcs-storage",
        storage_type=vessl.storage.StorageType.GCS,
        path="my-bucket",
        credential_name="my-aws-credential",
    )
    
  • Create an NFS storage:
    vessl.storage.create_storage(
        name="my-nfs-storage",
        storage_type=vessl.storage.StorageType.NFS,
        path="my.nfs.com:/shared/data",
        cluster_name="my-cluster",
    )
    
  • Create an HOST PATH storage:
    vessl.storage.create_storage(
        name="my-host-path-storage",
        storage_type=vessl.storage.StorageType.HOST_PATH,
        path=" /data/host-folder",
        cluster_name="my-cluster",
    )
    

list_storages

vessl.storage.list_storages(**kwargs)

List storages in the default organization. If you want to override the default organization, then pass organization_name as **kwargs.

Example

vessl.storage.list_storages()

delete_storage

vessl.storage.delete_storage(
    name: str,
)

Delete storage.

Args

  • name (str) : Name of the storage to delete.

Example

vessl.storage.delete_storage(name="my-storage")

create_volume

vessl.storage.create_volume(
    name: str,
    storage_name: str,
    tags: tuple[str, ...],
)

Create a volume in storage.

Args

  • name (str) : Name of the volume.
  • storage_name (str) : Name of the storage.
  • tags (tuple[str, …]) : Tags of the volume.

Example

vessl.storage.create_volume(
    name="my-volume",
    storage_name="my-storage",
    tags=("my-tag1", "my-tag2"),
)

list_volumes

vessl.storage.list_volumes(
    storage_name: str,
    keyword: Optional[str],
)

List volumes in storage.

Args

  • storage_name (str) : Name of the storage.
  • keyword (str) : Optional search keyword.

Example

vessl.storage.list_volumes(storage_name="my-storage")

delete_volume

vessl.storage.delete_volume(
    name: str,
    storage_name: str,
)

Delete volume in storage.

Args

  • name (str) : Name of the volume.
  • storage_name (str) : Name of the storage.

Example

vessl.storage.delete_volume(
    name="my-volume",
    storage_name="my-storage",
)

list_volume_files

vessl.storage.list_volume_files(
    storage_name: str,
    volume_name: str,
    path: Optional[str],
)

List all files in a volume.

Args

  • storage_name (str) : Name of the storage.
  • volume_name (str) : Name of the volume.
  • path (Optional[str]) : Path of directory to list. Defaults to "".

Example

vessl.storage.list_volume_files(
    storage_name="my-storage",
    volume_name="my-volume",
)

upload_volume_file

vessl.storage.upload_volume_file(
    source_path: str,
    dest_storage_name: str,
    dest_volume_name: str,
    dest_path: Optional[str],
)

Upload a file to a volume.

Args

  • source_path (str) : Path of local directory of file to upload.
  • dest_storage_name (str) : Name of the storage.
  • dest_volume_name (str) : Name of the volume.
  • dest_path (str) : Path of volume directory to upload the file to. Defaults to ”/”.

Example

vessl.storage.upload_volume_file(
    source_path="/path/to/file",
    dest_storage_name="my-storage",
    dest_volume_name="my-volume",
)

download_volume_file

vessl.storage.download_volume_file(
    source_storage_name: str,
    source_volume_name: str,
    dest_path: str,
)

Download a file from a volume.

Args

  • source_storage_name (str) : Name of the storage.
  • source_volume_name (str) : Name of the volume in the storage.
  • dest_path (str) : Path of local directory to download the file to.

Example

vessl.storage.download_volume_file(
    source_storage_name="my-storage",
    source_volume_name="my-volume",
    dest_path="models"
)

delete_volume_file

vessl.storage.delete_volume_file(
    storage_name: str, 
    volume_name: str, 
    path: str, 
    recursive: Optional[bool],
)

Delete a file from a volume.

Args

  • storage_name (str) : Name of the storage.
  • volume_name (str) : Name of the volume in the storage.
  • path (str) : Path of directory or file in volume to delete.
  • recursive (Optional[bool]) : If true, delete all files in this directory. Defaults to False.

Example

vessl.storage.delete_volume_file(
    storage_name="my-storage",
    volume_name="my-volume",
    path="model.pth"
)