Clusters
Provision and manage Onehouse compute clusters.
Methods
| Method | Description |
|---|---|
create_cluster | Create a new cluster |
alter_cluster | Change cluster size, state, name, or options |
delete_cluster | Delete a cluster |
describe_cluster | Show full configuration for a cluster |
show_clusters | List all clusters in the project |
alter_ocu_limit | Set the project's OCU limit |
create_cluster
create_cluster(
name: str,
*,
type: str,
max_ocu: int | None = None,
min_ocu: int | None = None,
options: Mapping[str, str] | None = None,
unsafe_raw: bool = False,
timeout: float | None = None,
poll_interval: float | None = None,
)
| Parameter | Required | Type / values |
|---|---|---|
name | yes | str |
type | yes | "Managed", "SQL", "Spark", "Open_Engines", "Notebook", "PySpark", "Lakegres" |
max_ocu | no | int |
min_ocu | no | int |
options | no | Mapping[str, str] — passed as WITH (...) |
Example
client.create_cluster(
"prod",
type="Managed",
max_ocu=10,
min_ocu=1,
options={"worker.type": "oh-general-4"},
)
alter_cluster
alter_cluster(
name: str,
*,
state: str | None = None,
max_ocu: int | None = None,
min_ocu: int | None = None,
new_name: str | None = None,
options: Mapping[str, str] | None = None,
unsafe_raw: bool = False,
timeout: float | None = None,
poll_interval: float | None = None,
)
At least one of state, max_ocu, min_ocu, new_name, or options must be supplied.
| Parameter | Required | Type / values |
|---|---|---|
name | yes | str |
state | no | "START", "STOP" |
max_ocu | no | int |
min_ocu | no | int |
new_name | no | str |
options | no | Mapping[str, str] |
Examples
# Stop a cluster
client.alter_cluster("prod", state="STOP")
# Resize
client.alter_cluster("prod", min_ocu=2, max_ocu=20)
# Rename
client.alter_cluster("prod", new_name="prod-east")
delete_cluster
delete_cluster(name: str, *, unsafe_raw=False, timeout=None, poll_interval=None)
Example
client.delete_cluster("prod")
describe_cluster
describe_cluster(name: str, *, unsafe_raw=False, timeout=None, poll_interval=None)
Example
result = client.describe_cluster("prod")
print(result.api_response)
show_clusters
show_clusters(*, timeout=None, poll_interval=None)
Example
result = client.show_clusters()
alter_ocu_limit
alter_ocu_limit(limit: float, *, timeout=None, poll_interval=None)
Sets the OCU limit for the project. See ALTER OCU.
| Parameter | Required | Type / values |
|---|---|---|
limit | yes | int or float — finite and not negative. Anything else raises ValueError. |
Example
client.alter_ocu_limit(15)
# ALTER OCU SET LIMIT = 15