Bodo Platform SDK Reference
bodosdk.clients.cluster
¶
ClusterClient
¶
Bases:
A client for managing cluster operations in a Bodo workspace.
Attributes:
Name | Type | Description |
---|---|---|
|
|
A dictionary of deprecated methods. |
|
|
A list of available Bodo images. |
Parameters:
Name | Type | Description | Default |
---|---|---|---|
workspace_client |
|
The workspace client used for operations. |
required |
Cluster: Cluster
property
¶
Provides access to cluster operations.
Returns:
Name | Type | Description |
---|---|---|
Cluster |
|
An instance of Cluster for cluster operations. |
ClusterList: ClusterList
property
¶
Provides access to listing clusters.
Returns:
Name | Type | Description |
---|---|---|
ClusterList |
|
An instance of ClusterListAPIModel for listing clusters. |
latest_bodo_version: str
property
¶
Retrieves the latest Bodo version available.
Returns:
Name | Type | Description |
---|---|---|
str |
|
The latest Bodo version. |
__init__(workspace_client)
¶
Initializes the ClusterClient with a given workspace client.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
workspace_client |
|
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, memory_report_enabled=None)
¶
Creates a new cluster with the specified configuration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
|
The name of the cluster. |
required |
instance_type |
|
The type of instance to use for the cluster nodes. |
None
|
workers_quantity |
|
The number of worker nodes in the cluster. |
None
|
description |
|
A description of the cluster. |
None
|
bodo_version |
|
The Bodo version to use for the cluster. If not provided, the latest version is used. |
None
|
auto_stop |
|
The auto-stop time in minutes for the cluster. |
None
|
auto_pause |
|
The auto-pause time in minutes for the cluster. |
None
|
auto_upgrade |
|
Should the cluster be automatically upgraded to the latest Bodo version on restart. |
None
|
auto_az |
|
Whether to automatically select the availability zone. |
None
|
use_spot_instance |
|
Whether to use spot instances for the cluster. |
None
|
aws_deployment_subnet_id |
|
The AWS deployment subnet ID. |
None
|
availability_zone |
|
The availability zone for the cluster. |
None
|
instance_role |
|
The instance role or a custom role configuration. |
None
|
custom_tags |
|
Custom tags to assign to the cluster resources. |
None
|
Returns:
Name | Type | Description |
---|---|---|
Cluster |
|
The created Cluster object. |
get(id)
¶
Retrieves a cluster by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id |
|
The ID of the cluster to retrieve. |
required |
Returns:
Name | Type | Description |
---|---|---|
Cluster |
|
The retrieved Cluster object. |
get_bodo_versions()
¶
Retrieves a list of available Bodo versions.
Returns:
Type | Description |
---|---|
|
List[str]: A list of available Bodo versions. |
get_images()
¶
Retrieves a list of available images.
Returns:
Type | Description |
---|---|
|
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 |
|
The filters to apply to the cluster listing. |
None
|
order |
|
The order in which to list the clusters. |
None
|
Returns:
Name | Type | Description |
---|---|---|
ClusterList |
|
A list of clusters matching the criteria. |
pause(id, wait=False)
¶
Pauses the specified cluster.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id |
|
The ID of the cluster to pause. |
required |
Returns:
Name | Type | Description |
---|---|---|
Cluster |
|
The paused Cluster object. |
remove(id, wait=False)
¶
Removes the specified cluster.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id |
|
The ID of the cluster to remove. |
required |
Returns:
Type | Description |
---|---|
|
None |
resume(id, wait=False)
¶
Resumes the specified paused cluster.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id |
|
The ID of the cluster to resume. |
required |
Returns:
Name | Type | Description |
---|---|---|
Cluster |
|
The resumed Cluster object. |
scale(id, new_size)
¶
Scales the specified cluster to the new size.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id |
|
The ID of the cluster to scale. |
required |
new_size |
|
The new size for the cluster in terms of the number of worker nodes. |
required |
Returns:
Name | Type | Description |
---|---|---|
Cluster |
|
The scaled Cluster object. |
start(id, wait=False)
¶
Starts the specified stopped cluster.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id |
|
The ID of the cluster to start. |
required |
Returns:
Name | Type | Description |
---|---|---|
Cluster |
|
The started Cluster object. |
stop(id, wait=False)
¶
Stops the specified cluster.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id |
|
The ID of the cluster to stop. |
required |
Returns:
Name | Type | Description |
---|---|---|
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 |
|
The ID of the cluster to update. |
required |
name |
|
The new name for the cluster. |
None
|
description |
|
A new description for the cluster. |
None
|
auto_stop |
|
The new auto-stop time in minutes. |
None
|
auto_pause |
|
The new auto-pause time in minutes. |
None
|
auto_upgrade |
|
if cluster should be updated after each restart. |
True
|
workers_quantity |
|
The new number of worker nodes. |
None
|
instance_role |
|
The new instance role or custom role configuration. |
None
|
instance_type |
|
The new instance type for the cluster nodes. |
None
|
bodo_version |
|
The new Bodo version for the cluster. |
None
|
auto_az |
|
Whether to automatically select the availability zone. |
None
|
availability_zone |
|
The new availability zone for the cluster. |
None
|
custom_tags |
|
New custom tags for the cluster resources. |
None
|
Returns:
Name | Type | Description |
---|---|---|
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 |
|
The ID of the cluster to monitor. |
required |
statuses |
|
The list of statuses to wait for. |
required |
timeout |
|
The timeout period in seconds. |
300
|
tick |
|
The interval in seconds between status checks. |
30
|
Returns:
Name | Type | Description |
---|---|---|
Cluster |
|
The Cluster object if it reaches the desired status within the timeout period. |
bodosdk.clients.instance_role
¶
InstanceRoleClient
¶
Bases:
InstanceRole: InstanceRole
property
¶
Get the InstanceRole object.
Returns:
Name | Type | Description |
---|---|---|
InstanceRole |
|
An instance of InstanceRole. |
InstanceRoleList: InstanceRoleList
property
¶
Get the InstanceRoleList object.
Returns:
Name | Type | Description |
---|---|---|
InstanceRoleList |
|
An instance of InstanceRoleList. |
__init__(workspace_client)
¶
Initializes the InstanceRoleClient with a given workspace client.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
workspace_client |
|
The workspace client to interact with the API. |
required |
create(role_arn=None, identity=None, description=None, name=None)
¶
Create a new instance role.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
role_arn |
|
The ARN of the role (for aws). |
None
|
identity |
|
The identity of the role (for azure). |
None
|
description |
|
A description of the role. |
None
|
name |
|
The name of the role. Defaults to None. |
None
|
Returns:
Name | Type | Description |
---|---|---|
InstanceRole |
|
The created instance role after saving. |
delete(id)
¶
Delete an instance role by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id |
|
The UUID of the instance role to delete. |
required |
get(id)
¶
Get an instance role by its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id |
|
The UUID of the instance role. |
required |
Returns:
Name | Type | Description |
---|---|---|
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 |
|
A dictionary or InstanceRoleFilter |
None
|
order |
|
A dictionary to specify the order of the results. |
None
|
Returns:
Name | Type | Description |
---|---|---|
InstanceRoleList |
|
An instance of InstanceRoleList containing the filtered and ordered instance roles. |
bodosdk.clients.job
¶
JobClient
¶
Bases:
JobRun: bodosdk.models.job.JobRun
property
¶
Get the JobRun object.
Returns:
Name | Type | Description |
---|---|---|
JobRun |
|
An instance of JobRun. |
JobRunList: bodosdk.models.job.JobRunList
property
¶
Get the JobRunList object.
Returns:
Name | Type | Description |
---|---|---|
JobRunList |
|
An instance of JobRunList. |
__init__(workspace_client)
¶
Initializes the JobClient with a given workspace client.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
workspace_client |
|
The workspace client to interact with the API. |
required |
cancel_job(id)
¶
Cancel job by id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id |
|
Job id. |
required |
Returns:
Name | Type | Description |
---|---|---|
JobRun |
|
Job object. |
cancel_jobs(filters=None)
¶
Cancel jobs with the given filters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filters |
|
Filters to apply on the list. |
None
|
Returns:
Name | Type | Description |
---|---|---|
JobRunList |
|
JobRunList object. |
get(id)
¶
Get job by id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id |
|
Job id. |
required |
Returns:
Name | Type | Description |
---|---|---|
JobRun |
|
Job object. |
list(filters=None, order=None)
¶
List jobs with the given filters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filters |
|
Filters to apply on the list. |
None
|
order |
|
Order to apply on the list. |
None
|
Returns:
Name | Type | Description |
---|---|---|
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 |
|
Job template id. |
None
|
cluster |
|
Cluster object or cluster config. |
None
|
code_type |
|
Code type. |
None
|
source |
|
Source object. |
None
|
exec_file |
|
Exec file path. |
None
|
exec_text |
|
Exec text. |
None
|
args |
|
Arguments. |
None
|
env_vars |
|
Environment variables. |
None
|
timeout |
|
Timeout. |
None
|
num_retries |
|
Number of retries. |
None
|
delay_between_retries |
|
Delay between retries. |
None
|
retry_on_timeout |
|
Retry on timeout. |
None
|
name |
|
Job name. |
None
|
catalog |
|
Catalog, applicable only for SQL jobs. |
None
|
store_result |
|
Whether to store the result. |
None
|
Returns:
Name | Type | Description |
---|---|---|
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 |
|
Job template id. |
None
|
catalog |
|
Catalog. |
None
|
sql_query |
|
SQL query. |
None
|
cluster |
|
Cluster object or cluster config. |
None
|
name |
|
Job name. |
None
|
args |
|
Arguments. |
None
|
timeout |
|
Timeout. |
None
|
num_retries |
|
Number of retries. |
None
|
delay_between_retries |
|
Delay between retries. |
None
|
retry_on_timeout |
|
Retry on timeout. |
None
|
store_result |
|
Whether to store the result. |
True
|
Returns:
Name | Type | Description |
---|---|---|
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 |
|
Job id. |
required |
statuses |
|
List of statuses to wait for. |
required |
timeout |
|
Timeout. |
3600
|
tick |
|
Tick. |
30
|
Returns:
Name | Type | Description |
---|---|---|
JobRun |
|
Job object. |
bodosdk.clients.job_tpl
¶
JobTemplateClient
¶
Bases:
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 |
|
Name of the job template. |
None
|
description |
|
Description of the job template. |
None
|
cluster |
|
Cluster object or cluster config. |
None
|
code_type |
|
Code type. |
None
|
source |
|
Source object. |
None
|
exec_file |
|
Exec file path. |
None
|
exec_text |
|
Exec text. |
None
|
args |
|
Arguments. |
None
|
env_vars |
|
Environment variables. |
None
|
timeout |
|
Timeout. |
None
|
num_retries |
|
Number of retries. |
None
|
delay_between_retries |
|
Delay between retries. |
None
|
retry_on_timeout |
|
Retry on timeout. |
None
|
catalog |
|
Catalog, applicable only for SQL code type. |
None
|
store_result |
|
Whether to store the result. |
False
|
get(id)
¶
Get job template by id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id |
|
Job template id. |
required |
Returns:
Name | Type | Description |
---|---|---|
JobTemplate |
|
Job template object. |
list(filters=None)
¶
List job templates with the given filters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filters |
|
Filters to apply on the list. |
None
|
Returns:
Name | Type | Description |
---|---|---|
JobTemplateList |
|
JobTemplateList object. |
remove(id)
¶
Delete job template by id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id |
|
Job template id. |
required |
bodosdk.clients.organization
¶
BodoOrganizationClient
¶
Bases:
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 |
|
Name of the cloud config. |
required |
tf_backend_region |
|
Terraform backend region. |
required |
role_arn |
|
Role ARN. |
None
|
tf_bucket_name |
|
Terraform bucket name. |
None
|
tf_dynamo_db_table_name |
|
Terraform dynamo db table name. |
None
|
account_id |
|
Account id. |
None
|
access_key_id |
|
Access key id. |
None
|
secret_access_key |
|
Secret access key. |
None
|
custom_tags |
|
Custom tags for the cloud config. |
None
|
Returns:
Name | Type | Description |
---|---|---|
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 |
|
Name of the cloud config. |
required |
tf_backend_region |
|
Terraform backend region. |
required |
tenant_id |
|
Tenant id. |
required |
subscription_id |
|
Subscription id. |
required |
resource_group |
|
Resource group. |
required |
custom_tags |
|
Custom tags for the cloud config. |
None
|
Returns:
Name | Type | Description |
---|---|---|
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 |
|
Name of the workspace. |
required |
region |
|
Region of the workspace. |
required |
storage_endpoint_enabled |
|
Enable storage endpoint for the workspace. |
required |
cloud_config_id |
|
Cloud config id for the workspace. |
required |
vpc_id |
|
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 object. |
delete_workspace(id)
¶
Delete workspace by id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id |
|
Workspace id. |
required |
Returns:
Name | Type | Description |
---|---|---|
Workspace |
|
Workspace object. |
get_cloud_config(id)
¶
Get cloud config by id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id |
|
Cloud config id. |
required |
Returns:
Name | Type | Description |
---|---|---|
CloudConfig |
|
CloudConfig object. |
get_workspace(id)
¶
Get workspace by id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id |
|
Workspace id. |
required |
Returns:
Name | Type | Description |
---|---|---|
Workspace |
|
Workspace object. |
list_cloud_configs(filters=None)
¶
List cloud configs in the organization.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filters |
|
Filters to apply on the list. |
None
|
Returns:
Name | Type | Description |
---|---|---|
CloudConfigList |
|
CloudConfigList object. |
list_workspaces(filters=None)
¶
List workspaces in the organization.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filters |
|
Filters to apply on the list. |
None
|
Returns:
Name | Type | Description |
---|---|---|
WorkspaceList |
|
WorkspaceList object. |
bodosdk.clients.workspace
¶
BodoWorkspaceClient
¶
Bases:
workspace_data: IWorkspace
property
¶
Get workspace data.
Returns:
Name | Type | Description |
---|---|---|
Workspace |
|
Workspace object. |
workspace_id: str
property
¶
Get workspace id.
Returns:
Name | Type | Description |
---|---|---|
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 |
|
Client id. |
None
|
secret_key |
|
Secret key. |
None
|
api_url |
|
API url. |
'https://api.bodo.ai/api'
|
auth_url |
|
Auth url. |
'https://auth.bodo.ai'
|
print_logs |
|
Print logs |
False
|
Raises:
Type | Description |
---|---|
|
If client_id or secret_key is not passed and environment variables are not set |
bodosdk.models.catalog
¶
bodosdk.models.cloud_config
¶
CloudConfig
¶
Bases:
,
__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 |
---|---|
|
A new instance of CloudConfig. |
__init__(org_client=None, **data)
¶
Initializes a new CloudConfig model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
org_client |
|
An optional client for interacting with the CloudConfig API. |
None
|
**data |
Arbitrary keyword arguments representing CloudConfig properties. |
{}
|