@Generated public interface ClustersService
Databricks maps cluster node instance types to compute units known as DBUs. See the instance type pricing page for a list of the supported instance types and their corresponding DBUs.
A Databricks cluster is a set of computation resources and configurations on which you run data engineering, data science, and data analytics workloads, such as production ETL pipelines, streaming analytics, ad-hoc analytics, and machine learning.
You run these workloads as a set of commands in a notebook or as an automated job. Databricks makes a distinction between all-purpose clusters and job clusters. You use all-purpose clusters to analyze data collaboratively using interactive notebooks. You use job clusters to run fast and robust automated jobs.
You can create an all-purpose cluster using the UI, CLI, or REST API. You can manually terminate and restart an all-purpose cluster. Multiple users can share such clusters to do collaborative interactive analysis.
IMPORTANT: Databricks retains cluster configuration information for terminated clusters for 30 days. To keep an all-purpose cluster configuration even after it has been terminated for more than 30 days, an administrator can pin a cluster to the cluster list.
This is the high-level interface, that contains generated methods.
Evolving: this interface is under development. Method signatures may change.
| Modifier and Type | Method and Description |
|---|---|
void |
changeOwner(ChangeClusterOwner changeClusterOwner)
Change cluster owner.
|
CreateClusterResponse |
create(CreateCluster createCluster)
Create new cluster.
|
void |
delete(DeleteCluster deleteCluster)
Terminate cluster.
|
void |
edit(EditCluster editCluster)
Update cluster configuration.
|
GetEventsResponse |
events(GetEvents getEvents)
List cluster activity events.
|
ClusterDetails |
get(GetClusterRequest getClusterRequest)
Get cluster info.
|
GetClusterPermissionLevelsResponse |
getPermissionLevels(GetClusterPermissionLevelsRequest getClusterPermissionLevelsRequest)
Get cluster permission levels.
|
ClusterPermissions |
getPermissions(GetClusterPermissionsRequest getClusterPermissionsRequest)
Get cluster permissions.
|
ListClustersResponse |
list(ListClustersRequest listClustersRequest)
List clusters.
|
ListNodeTypesResponse |
listNodeTypes()
List node types.
|
ListAvailableZonesResponse |
listZones()
List availability zones.
|
void |
permanentDelete(PermanentDeleteCluster permanentDeleteCluster)
Permanently delete cluster.
|
void |
pin(PinCluster pinCluster)
Pin cluster.
|
void |
resize(ResizeCluster resizeCluster)
Resize cluster.
|
void |
restart(RestartCluster restartCluster)
Restart cluster.
|
ClusterPermissions |
setPermissions(ClusterPermissionsRequest clusterPermissionsRequest)
Set cluster permissions.
|
GetSparkVersionsResponse |
sparkVersions()
List available Spark versions.
|
void |
start(StartCluster startCluster)
Start terminated cluster.
|
void |
unpin(UnpinCluster unpinCluster)
Unpin cluster.
|
void |
update(UpdateCluster updateCluster)
Update cluster configuration (partial).
|
ClusterPermissions |
updatePermissions(ClusterPermissionsRequest clusterPermissionsRequest)
Update cluster permissions.
|
void changeOwner(ChangeClusterOwner changeClusterOwner)
Change the owner of the cluster. You must be an admin and the cluster must be terminated to perform this operation. The service principal application ID can be supplied as an argument to `owner_username`.
CreateClusterResponse create(CreateCluster createCluster)
Creates a new Spark cluster. This method will acquire new instances from the cloud provider if necessary. This method is asynchronous; the returned ``cluster_id`` can be used to poll the cluster status. When this method returns, the cluster will be in a ``PENDING`` state. The cluster will be usable once it enters a ``RUNNING`` state. Note: Databricks may not be able to acquire some of the requested nodes, due to cloud provider limitations (account limits, spot price, etc.) or transient network issues.
If Databricks acquires at least 85% of the requested on-demand nodes, cluster creation will succeed. Otherwise the cluster will terminate with an informative error message.
Rather than authoring the cluster's JSON definition from scratch, Databricks recommends filling out the [create compute UI] and then copying the generated JSON definition from the UI.
[create compute UI]: https://docs.databricks.com/compute/configure.html
void delete(DeleteCluster deleteCluster)
Terminates the Spark cluster with the specified ID. The cluster is removed asynchronously. Once the termination has completed, the cluster will be in a `TERMINATED` state. If the cluster is already in a `TERMINATING` or `TERMINATED` state, nothing will happen.
void edit(EditCluster editCluster)
Updates the configuration of a cluster to match the provided attributes and size. A cluster can be updated if it is in a `RUNNING` or `TERMINATED` state.
If a cluster is updated while in a `RUNNING` state, it will be restarted so that the new attributes can take effect.
If a cluster is updated while in a `TERMINATED` state, it will remain `TERMINATED`. The next time it is started using the `clusters/start` API, the new attributes will take effect. Any attempt to update a cluster in any other state will be rejected with an `INVALID_STATE` error code.
Clusters created by the Databricks Jobs service cannot be edited.
GetEventsResponse events(GetEvents getEvents)
Retrieves a list of events about the activity of a cluster. This API is paginated. If there are more events to read, the response includes all the parameters necessary to request the next page of events.
ClusterDetails get(GetClusterRequest getClusterRequest)
Retrieves the information for a cluster given its identifier. Clusters can be described while they are running, or up to 60 days after they are terminated.
GetClusterPermissionLevelsResponse getPermissionLevels(GetClusterPermissionLevelsRequest getClusterPermissionLevelsRequest)
Gets the permission levels that a user can have on an object.
ClusterPermissions getPermissions(GetClusterPermissionsRequest getClusterPermissionsRequest)
Gets the permissions of a cluster. Clusters can inherit permissions from their root object.
ListClustersResponse list(ListClustersRequest listClustersRequest)
Return information about all pinned and active clusters, and all clusters terminated within the last 30 days. Clusters terminated prior to this period are not included.
ListNodeTypesResponse listNodeTypes()
Returns a list of supported Spark node types. These node types can be used to launch a cluster.
ListAvailableZonesResponse listZones()
Returns a list of availability zones where clusters can be created in (For example, us-west-2a). These zones can be used to launch a cluster.
void permanentDelete(PermanentDeleteCluster permanentDeleteCluster)
Permanently deletes a Spark cluster. This cluster is terminated and resources are asynchronously removed.
In addition, users will no longer see permanently deleted clusters in the cluster list, and API users can no longer perform any action on permanently deleted clusters.
void pin(PinCluster pinCluster)
Pinning a cluster ensures that the cluster will always be returned by the ListClusters API. Pinning a cluster that is already pinned will have no effect. This API can only be called by workspace admins.
void resize(ResizeCluster resizeCluster)
Resizes a cluster to have a desired number of workers. This will fail unless the cluster is in a `RUNNING` state.
void restart(RestartCluster restartCluster)
Restarts a Spark cluster with the supplied ID. If the cluster is not currently in a `RUNNING` state, nothing will happen.
ClusterPermissions setPermissions(ClusterPermissionsRequest clusterPermissionsRequest)
Sets permissions on an object, replacing existing permissions if they exist. Deletes all direct permissions if none are specified. Objects can inherit permissions from their root object.
GetSparkVersionsResponse sparkVersions()
Returns the list of available Spark versions. These versions can be used to launch a cluster.
void start(StartCluster startCluster)
Starts a terminated Spark cluster with the supplied ID. This works similar to `createCluster` except: - The previous cluster id and attributes are preserved. - The cluster starts with the last specified cluster size. - If the previous cluster was an autoscaling cluster, the current cluster starts with the minimum number of nodes. - If the cluster is not currently in a ``TERMINATED`` state, nothing will happen. - Clusters launched to run a job cannot be started.
void unpin(UnpinCluster unpinCluster)
Unpinning a cluster will allow the cluster to eventually be removed from the ListClusters API. Unpinning a cluster that is not pinned will have no effect. This API can only be called by workspace admins.
void update(UpdateCluster updateCluster)
Updates the configuration of a cluster to match the partial set of attributes and size. Denote which fields to update using the `update_mask` field in the request body. A cluster can be updated if it is in a `RUNNING` or `TERMINATED` state. If a cluster is updated while in a `RUNNING` state, it will be restarted so that the new attributes can take effect. If a cluster is updated while in a `TERMINATED` state, it will remain `TERMINATED`. The updated attributes will take effect the next time the cluster is started using the `clusters/start` API. Attempts to update a cluster in any other state will be rejected with an `INVALID_STATE` error code. Clusters created by the Databricks Jobs service cannot be updated.
ClusterPermissions updatePermissions(ClusterPermissionsRequest clusterPermissionsRequest)
Updates the permissions on a cluster. Clusters can inherit permissions from their root object.
Copyright © 2025. All rights reserved.