Skip to main content

Module clients.sandbox.h2o_drive.client

Classes

H2ODriveClient

class H2ODriveClient(connection_config: h2o_engine_manager.clients.connection_config.ConnectionConfig, verify_ssl: bool = True, ssl_ca_cert: Optional[str] = None)

H2ODriveClient manages H2O Drive operations within a SandboxEngine.

This client provides methods to upload and download files between a SandboxEngine's filesystem and H2O Drive cloud storage. The AI Engine Manager acts as a proxy, so the sandbox engine does not connect directly to H2O Drive.

Args
connection_config
AIEM connection configuration object.
verify_ssl
Set to False to disable SSL certificate verification.
ssl_ca_cert
Path to a CA cert bundle with certificates of trusted CAs.

Methods

download_file

def download_file(self, name: str, remote_path: str, local_path: str, workspace: Optional[str] = None, create_parent_directories: bool = False, overwrite: Optional[bool] = None) ‑> h2o_engine_manager.clients.sandbox.h2o_drive.download_file_response.DownloadFileResponse

Download a file from H2O Drive to the sandbox filesystem.

Retrieves a file from H2O Drive and writes it to the specified path in the sandbox filesystem. The caller must have read permissions for the specified workspace.

Args
name : str
SandboxEngine resource name. Format: "workspaces//sandboxEngines/"
remote_path : str
The relative path of the file in H2O Drive to download. Must be relative to the workspace root (no leading slash). Example: "data/input.csv"
local_path : str
The absolute path in the sandbox filesystem where the file should be written. Must start with a forward slash (e.g., "/workspace/data/input.csv").
workspace : Optional[str]
The workspace resource name to use for H2O Drive access. Format: "workspaces/*" If not specified, defaults to the sandbox engine's parent workspace.
create_parent_directories : bool
If True, creates parent directories if they don't exist. Defaults to False.
overwrite : Optional[bool]
Controls overwrite behavior. If True or None, overwrites the file if it exists. If False, the operation will fail if the file already exists.
Returns
DownloadFileResponse
Response containing metadata about the downloaded file.

upload_file

def upload_file(self, name: str, local_path: str, remote_path: str, workspace: Optional[str] = None) ‑> h2o_engine_manager.clients.sandbox.h2o_drive.upload_file_response.UploadFileResponse

Upload a file from the sandbox filesystem to H2O Drive.

Reads a file from the sandbox filesystem and stores it in H2O Drive at the specified path. If the file already exists in H2O Drive, it will be overwritten. The caller must have write permissions for the specified workspace.

Args
name : str
SandboxEngine resource name. Format: "workspaces//sandboxEngines/"
local_path : str
The absolute path of the file in the sandbox filesystem to upload. Must start with a forward slash (e.g., "/workspace/output/results.csv").
remote_path : str
The relative path in H2O Drive where the file should be stored. Must be relative to the workspace root (no leading slash). Example: "output/results.csv"
workspace : Optional[str]
The workspace resource name to use for H2O Drive access. Format: "workspaces/*" If not specified, defaults to the sandbox engine's parent workspace.
Returns
UploadFileResponse
Response containing the number of bytes uploaded.

Feedback