Skip to content

Bodo Platform SDK Reference

bodosdk.clients.cluster

ClusterClient

Bases: IClusterClient

A client for managing cluster operations in a Bodo workspace.

Attributes:

Name Type Description
_deprecated_methods Dict

A dictionary of deprecated methods.

_images List[IBodoImage]

A list of available Bodo images.

Parameters:

Name Type Description Default
workspace_client IBodoWorkspaceClient

The workspace client used for operations.

required

Cluster: Cluster property

Provides access to cluster operations.

Returns:

Name Type Description
Cluster Cluster

An instance of Cluster for cluster operations.

ClusterList: ClusterList property

Provides access to listing clusters.

Returns:

Name Type Description
ClusterList ClusterList

An instance of ClusterListAPIModel for listing clusters.

latest_bodo_version: str property

Retrieves the latest Bodo version available.

Returns:

Name Type Description
str str

The latest Bodo version.

__init__(workspace_client)

Initializes the ClusterClient with a given workspace client.

Parameters:

Name Type Description Default
workspace_client IBodoWorkspaceClient

The workspace client to interact with the API.

required

connect(catalog, cluster_id)

Connect to a specific catalog and cluster.

:param catalog: The name the catalog to connect to. :param cluster_id: The UUID of the cluster to connect to. :return: An instance of Connection representing the connection to the catalog and cluster.

create(name, instance_type=None, workers_quantity=None, description=None, bodo_version=None, auto_stop=None, auto_pause=None, auto_upgrade=None, auto_az=None, use_spot_instance=None, aws_deployment_subnet_id=None, availability_zone=None, instance_role=None, custom_tags=None)

Creates a new cluster with the specified configuration.

Parameters:

Name Type Description Default
name str

The name of the cluster.

required
instance_type str

The type of instance to use for the cluster nodes.

None
workers_quantity int

The number of worker nodes in the cluster.

None
description str

A description of the cluster.

None
bodo_version str

The Bodo version to use for the cluster. If not provided, the latest version is used.

None
auto_stop int

The auto-stop time in minutes for the cluster.

None
auto_pause int

The auto-pause time in minutes for the cluster.

None
auto_upgrade bool

Should the cluster be automatically upgraded to the latest Bodo version on restart.

None
auto_az bool

Whether to automatically select the availability zone.

None
use_spot_instance bool

Whether to use spot instances for the cluster.

None
aws_deployment_subnet_id str

The AWS deployment subnet ID.

None
availability_zone str

The availability zone for the cluster.

None
instance_role InstanceRole | Dict

The instance role or a custom role configuration.

None
custom_tags Dict

Custom tags to assign to the cluster resources.

None

Returns:

Name Type Description
Cluster Cluster

The created Cluster object.

get(id)

Retrieves a cluster by its ID.

Parameters:

Name Type Description Default
id str

The ID of the cluster to retrieve.

required

Returns:

Name Type Description
Cluster Cluster

The retrieved Cluster object.

get_bodo_versions()

Retrieves a list of available Bodo versions.

Returns:

Type Description
List[str]

List[str]: A list of available Bodo versions.

get_images()

Retrieves a list of available images.

Returns:

Type Description
List[str]

List[str]: A list of image IDs available for clusters.

get_instance_types()

Retrieves list of all supported instance types

Return

List[InstanceType]

list(filters=None, order=None)

Lists clusters based on the provided filters and order.

Parameters:

Name Type Description Default
filters Dict | ClusterFilter

The filters to apply to the cluster listing.

None
order Dict

The order in which to list the clusters.

None

Returns:

Name Type Description
ClusterList ClusterList

A list of clusters matching the criteria.

pause(id, wait=False)

Pauses the specified cluster.

Parameters:

Name Type Description Default
id str

The ID of the cluster to pause.

required

Returns:

Name Type Description
Cluster Cluster

The paused Cluster object.

remove(id, wait=False)

Removes the specified cluster.

Parameters:

Name Type Description Default
id str

The ID of the cluster to remove.

required

Returns:

Type Description
Cluster

None

resume(id, wait=False)

Resumes the specified paused cluster.

Parameters:

Name Type Description Default
id str

The ID of the cluster to resume.

required

Returns:

Name Type Description
Cluster Cluster

The resumed Cluster object.

scale(id, new_size)

Scales the specified cluster to the new size.

Parameters:

Name Type Description Default
id str

The ID of the cluster to scale.

required
new_size int

The new size for the cluster in terms of the number of worker nodes.

required

Returns:

Name Type Description
Cluster Cluster

The scaled Cluster object.

start(id, wait=False)

Starts the specified stopped cluster.

Parameters:

Name Type Description Default
id str

The ID of the cluster to start.

required

Returns:

Name Type Description
Cluster Cluster

The started Cluster object.

stop(id, wait=False)

Stops the specified cluster.

Parameters:

Name Type Description Default
id str

The ID of the cluster to stop.

required

Returns:

Name Type Description
Cluster Cluster

The stopped Cluster object.

update(id, name=None, description=None, auto_stop=None, auto_pause=None, auto_upgrade=True, workers_quantity=None, instance_role=None, instance_type=None, bodo_version=None, auto_az=None, availability_zone=None, custom_tags=None)

Updates the specified cluster with the given configuration.

Parameters:

Name Type Description Default
id str

The ID of the cluster to update.

required
name str

The new name for the cluster.

None
description str

A new description for the cluster.

None
auto_stop int

The new auto-stop time in minutes.

None
auto_pause int

The new auto-pause time in minutes.

None
auto_upgrade bool

if cluster should be updated after each restart.

True
workers_quantity int

The new number of worker nodes.

None
instance_role InstanceRole | Dict

The new instance role or custom role configuration.

None
instance_type str

The new instance type for the cluster nodes.

None
bodo_version str

The new Bodo version for the cluster.

None
auto_az bool

Whether to automatically select the availability zone.

None
availability_zone str

The new availability zone for the cluster.

None
custom_tags Dict

New custom tags for the cluster resources.

None

Returns:

Name Type Description
Cluster Cluster

The updated Cluster object.

wait_for_status(id, statuses, timeout=300, tick=30)

Waits for the specified cluster to reach any of the given statuses within the timeout period.

Parameters:

Name Type Description Default
id str

The ID of the cluster to monitor.

required
statuses List

The list of statuses to wait for.

required
timeout int

The timeout period in seconds.

300
tick int

The interval in seconds between status checks.

30

Returns:

Name Type Description
Cluster Cluster

The Cluster object if it reaches the desired status within the timeout period.

bodosdk.clients.instance_role

InstanceRoleClient

Bases: IInstanceRoleClient

InstanceRole: InstanceRole property

Get the InstanceRole object.

Returns:

Name Type Description
InstanceRole InstanceRole

An instance of InstanceRole.

InstanceRoleList: InstanceRoleList property

Get the InstanceRoleList object.

Returns:

Name Type Description
InstanceRoleList InstanceRoleList

An instance of InstanceRoleList.

__init__(workspace_client)

Initializes the InstanceRoleClient with a given workspace client.

Parameters:

Name Type Description Default
workspace_client IBodoWorkspaceClient

The workspace client to interact with the API.

required

create(role_arn, description, name=None)

Create a new instance role.

Parameters:

Name Type Description Default
role_arn str

The ARN of the role.

required
description str

A description of the role.

required
name str

The name of the role. Defaults to None.

None

Returns:

Name Type Description
InstanceRole InstanceRole

The created instance role after saving.

delete(id)

Delete an instance role by its ID.

Parameters:

Name Type Description Default
id str

The UUID of the instance role to delete.

required

get(id)

Get an instance role by its ID.

Parameters:

Name Type Description Default
id str

The UUID of the instance role.

required

Returns:

Name Type Description
InstanceRole InstanceRole

An instance of InstanceRole.

list(filters=None, order=None)

List all instance roles with optional filters and order.

Parameters:

Name Type Description Default
filters Optional[Union[Dict, InstanceRoleFilter]]

A dictionary or InstanceRoleFilter

None
order Optional[Dict]

A dictionary to specify the order of the results.

None

Returns:

Name Type Description
InstanceRoleList InstanceRoleList

An instance of InstanceRoleList containing the filtered and ordered instance roles.

bodosdk.clients.job

JobClient

Bases: IJobClient

JobRun: bodosdk.models.job.JobRun property

Get the JobRun object.

Returns:

Name Type Description
JobRun JobRun

An instance of JobRun.

JobRunList: bodosdk.models.job.JobRunList property

Get the JobRunList object.

Returns:

Name Type Description
JobRunList JobRunList

An instance of JobRunList.

__init__(workspace_client)

Initializes the JobClient with a given workspace client.

Parameters:

Name Type Description Default
workspace_client IBodoWorkspaceClient

The workspace client to interact with the API.

required

cancel_job(id)

Cancel job by id.

Parameters:

Name Type Description Default
id str

Job id.

required

Returns:

Name Type Description
JobRun JobRun

Job object.

cancel_jobs(filters=None)

Cancel jobs with the given filters.

Parameters:

Name Type Description Default
filters Optional[Union[Dict, JobFilter]]

Filters to apply on the list.

None

Returns:

Name Type Description
JobRunList JobRunList

JobRunList object.

get(id)

Get job by id.

Parameters:

Name Type Description Default
id str

Job id.

required

Returns:

Name Type Description
JobRun JobRun

Job object.

list(filters=None, order=None)

List jobs with the given filters.

Parameters:

Name Type Description Default
filters Optional[Union[Dict, JobFilter]]

Filters to apply on the list.

None
order Optional[Dict]

Order to apply on the list.

None

Returns:

Name Type Description
JobRunList JobRunList

JobRunList object.

run(template_id=None, cluster=None, code_type=None, source=None, exec_file=None, exec_text=None, args=None, env_vars=None, timeout=None, num_retries=None, delay_between_retries=None, retry_on_timeout=None, name=None, catalog=None, store_result=None)

Run a job with the given parameters.

Parameters:

Name Type Description Default
template_id str

Job template id.

None
cluster Union[dict, ICluster]

Cluster object or cluster config.

None
code_type str

Code type.

None
source Union[dict, IS3Source, IGitRepoSource, IWorkspaceSource, ITextSource]

Source object.

None
exec_file str

Exec file path.

None
exec_text str

Exec text.

None
args Union[Sequence[Any], Dict, str]

Arguments.

None
env_vars dict

Environment variables.

None
timeout int

Timeout.

None
num_retries int

Number of retries.

None
delay_between_retries int

Delay between retries.

None
retry_on_timeout bool

Retry on timeout.

None
name str

Job name.

None
catalog str

Catalog, applicable only for SQL jobs.

None
store_result bool

Whether to store the result.

None

Returns:

Name Type Description
JobRun JobRun

Job object.

run_sql_query(template_id=None, catalog=None, sql_query=None, cluster=None, name=None, args=None, timeout=None, num_retries=None, delay_between_retries=None, retry_on_timeout=None, store_result=True)

Run a SQL job with the given parameters.

Parameters:

Name Type Description Default
template_id str

Job template id.

None
catalog str

Catalog.

None
sql_query str

SQL query.

None
cluster Union[dict, ICluster]

Cluster object or cluster config.

None
name str

Job name.

None
args Union[Sequence[Any], Dict]

Arguments.

None
timeout int

Timeout.

None
num_retries int

Number of retries.

None
delay_between_retries int

Delay between retries.

None
retry_on_timeout bool

Retry on timeout.

None
store_result bool

Whether to store the result.

True

Returns:

Name Type Description
JobRun JobRun

Job object.

wait_for_status(id, statuses, timeout=3600, tick=30)

Wait for job to reach one of the given statuses.

Parameters:

Name Type Description Default
id str

Job id.

required
statuses List[str]

List of statuses to wait for.

required
timeout int

Timeout.

3600
tick int

Tick.

30

Returns:

Name Type Description
JobRun JobRun

Job object.

bodosdk.clients.job_tpl

JobTemplateClient

Bases: IJobTemplateClient

create(name=None, description=None, cluster=None, code_type=None, source=None, exec_file=None, exec_text=None, args=None, env_vars=None, timeout=None, num_retries=None, delay_between_retries=None, retry_on_timeout=None, catalog=None, store_result=False)

Create a new job template with the given parameters.

Parameters:

Name Type Description Default
name str

Name of the job template.

None
description str

Description of the job template.

None
cluster Union[dict, ICluster]

Cluster object or cluster config.

None
code_type str

Code type.

None
source Union[dict, IS3Source, IGitRepoSource, IWorkspaceSource, ITextSource]

Source object.

None
exec_file str

Exec file path.

None
exec_text str

Exec text.

None
args Union[dict, str]

Arguments.

None
env_vars dict

Environment variables.

None
timeout int

Timeout.

None
num_retries int

Number of retries.

None
delay_between_retries int

Delay between retries.

None
retry_on_timeout bool

Retry on timeout.

None
catalog str

Catalog, applicable only for SQL code type.

None
store_result bool

Whether to store the result.

False

get(id)

Get job template by id.

Parameters:

Name Type Description Default
id str

Job template id.

required

Returns:

Name Type Description
JobTemplate JobTemplate

Job template object.

list(filters=None)

List job templates with the given filters.

Parameters:

Name Type Description Default
filters Dict

Filters to apply on the list.

None

Returns:

Name Type Description
JobTemplateList JobTemplateList

JobTemplateList object.

remove(id)

Delete job template by id.

Parameters:

Name Type Description Default
id str

Job template id.

required

bodosdk.clients.organization

BodoOrganizationClient

Bases: IBodoOrganizationClient

create_aws_cloud_config(name, tf_backend_region, role_arn=None, tf_bucket_name=None, tf_dynamo_db_table_name=None, account_id=None, access_key_id=None, secret_access_key=None, custom_tags=None)

Create a new AWS cloud config in the organization with the given parameters.

Parameters:

Name Type Description Default
name str

Name of the cloud config.

required
tf_backend_region str

Terraform backend region.

required
role_arn Optional[str]

Role ARN.

None
tf_bucket_name Optional[str]

Terraform bucket name.

None
tf_dynamo_db_table_name Optional[str]

Terraform dynamo db table name.

None
account_id Optional[str]

Account id.

None
access_key_id Optional[str]

Access key id.

None
secret_access_key Optional[str]

Secret access key.

None
custom_tags Optional[dict]

Custom tags for the cloud config.

None

Returns:

Name Type Description
CloudConfig CloudConfig

CloudConfig object.

create_azure_cloud_config(name, tf_backend_region, tenant_id, subscription_id, resource_group, custom_tags=None)

Create a new Azure cloud config in the organization with the given parameters.

Parameters:

Name Type Description Default
name str

Name of the cloud config.

required
tf_backend_region str

Terraform backend region.

required
tenant_id str

Tenant id.

required
subscription_id str

Subscription id.

required
resource_group str

Resource group.

required
custom_tags Optional[dict]

Custom tags for the cloud config.

None

Returns:

Name Type Description
CloudConfig CloudConfig

CloudConfig object.

create_workspace(name, region, cloud_config_id, vpc_id=None, public_subnets_ids=None, private_subnets_ids=None, custom_tags=None, kms_key_arn=None)

Create a new workspace in the organization with the given parameters.

Parameters:

Name Type Description Default
name str

Name of the workspace.

required
region str

Region of the workspace.

required
storage_endpoint_enabled bool

Enable storage endpoint for the workspace.

required
cloud_config_id str

Cloud config id for the workspace.

required
vpc_id Optional[str]

VPC id for the workspace.

None
public_subnets_ids Optional(List[str]

List of public subnet ids.

None
private_subnets_ids Optional(List[str]

List of private subnet ids.

None
custom_tags Optional(dict

Custom tags for the workspace.

None

Returns:

Name Type Description
Workspace Workspace

Workspace object.

delete_workspace(id)

Delete workspace by id.

Parameters:

Name Type Description Default
id str

Workspace id.

required

Returns:

Name Type Description
Workspace Workspace

Workspace object.

get_cloud_config(id)

Get cloud config by id.

Parameters:

Name Type Description Default
id str

Cloud config id.

required

Returns:

Name Type Description
CloudConfig CloudConfig

CloudConfig object.

get_workspace(id)

Get workspace by id.

Parameters:

Name Type Description Default
id str

Workspace id.

required

Returns:

Name Type Description
Workspace Workspace

Workspace object.

list_cloud_configs(filters=None)

List cloud configs in the organization.

Parameters:

Name Type Description Default
filters Optional[Union[dict]]

Filters to apply on the list.

None

Returns:

Name Type Description
CloudConfigList CloudConfigList

CloudConfigList object.

list_workspaces(filters=None)

List workspaces in the organization.

Parameters:

Name Type Description Default
filters Optional[Union[WorkspaceFilter, dict]]

Filters to apply on the list.

None

Returns:

Name Type Description
WorkspaceList WorkspaceList

WorkspaceList object.

bodosdk.clients.workspace

BodoWorkspaceClient

Bases: IBodoWorkspaceClient

workspace_data: IWorkspace property

Get workspace data.

Returns:

Name Type Description
Workspace IWorkspace

Workspace object.

workspace_id: str property

Get workspace id.

Returns:

Name Type Description
str str

Workspace id.

__init__(client_id=None, secret_key=None, api_url='https://api.bodo.ai/api', auth_url='https://auth.bodo.ai', print_logs=False)

Initialize BodoWorkspaceClient.

Parameters:

Name Type Description Default
client_id str

Client id.

None
secret_key str

Secret key.

None
api_url str

API url.

'https://api.bodo.ai/api'
auth_url str

Auth url.

'https://auth.bodo.ai'
print_logs bool

Print logs

False

Raises:

Type Description
APIKeysMissing

If client_id or secret_key is not passed and environment variables are not set

bodosdk.models.catalog

CatalogList

Bases: ICatalogList, SDKBaseModel

Config

Configuration for Pydantic models. https://docs.pydantic.dev/latest/api/config/

bodosdk.models.cloud_config

CloudConfig

Bases: SDKBaseModel, ICloudConfig

__call__(**data)

Creates a new CloudConfig with the same CloudConfig client and provided data.

Parameters:

Name Type Description Default
**data

Arbitrary keyword arguments representing CloudConfig properties.

{}

Returns:

Type Description
CloudConfig

A new instance of CloudConfig.

__init__(org_client=None, **data)

Initializes a new CloudConfig model.

Parameters:

Name Type Description Default
org_client IBodoOrganizationClient

An optional client for interacting with the CloudConfig API.

None
**data

Arbitrary keyword arguments representing CloudConfig properties.

{}

CloudConfigList

Bases: ICloudConfigList, SDKBaseModel

Config

Configuration for Pydantic models. https://docs.pydantic.dev/latest/api/config/