Clusters API

The Clusters API allows you to create, start, edit, list, terminate, and delete clusters via the API. The maximum allowed size of a request to the Clusters API is 10MB.

Cluster lifecycle methods require a cluster ID, which is returned from Create. To obtain a list of clusters, invoke List.

Azure Databricks maps cluster node instance types to compute units known as DBUs. See the instance types pricing page for a list of the supported instance types and their corresponding DBUs. For cloud provider information, see Azure instance type specifications and pricing.

Azure Databricks will always provide one year’s deprecation notice before ceasing support for an Azure instance type.


Create

Endpoint HTTP Method
2.0/clusters/create POST

Creates a new Spark cluster. This method acquires new instances from the cloud provider if necessary. This method is asynchronous; the returned cluster_id can be used to poll the cluster state. When this method returns, the cluster is in a PENDING state. The cluster is usable once it enters a RUNNING state. See ClusterState.

Note

Azure Databricks may not be able to acquire some of the requested nodes, due to cloud provider limitations or transient network issues. If it is unable to acquire a sufficient number of the requested nodes, cluster creation will terminate with an informative error message.

An example request:

{
  "cluster_name": "my-cluster",
  "spark_version": "4.0.x-scala2.11",
  "node_type_id": "Standard_D3_v2",
  "spark_conf": {
    "spark.speculation": true
  },
  "num_workers": 25
}

Below is an example for an autoscaling cluster. Note that this cluster will start with 2 nodes, the minimum.

{
  "cluster_name": "autoscaling-cluster",
  "spark_version": "4.0.x-scala2.11",
  "node_type_id": "Standard_D3_v2",
  "autoscale" : {
    "min_workers": 2,
    "max_workers": 50
  }
}

Request Structure

Field Name Type Description
num_workers OR autoscale INT32 OR AutoScale

If num_workers, number of worker nodes that this cluster should have. A cluster has one Spark Driver and num_workers Executors for a total of num_workers + 1 Spark nodes.

Note: When reading the properties of a cluster, this field reflects the desired number of workers rather than the actual current number of workers. For instance, if a cluster is resized from 5 to 10 workers, this field will immediately be updated to reflect the target size of 10 workers, whereas the workers listed in spark_info will gradually increase from 5 to 10 as the new nodes are provisioned.

If autoscale, parameters needed in order to automatically scale clusters up and down based on load. Note: autoscaling works best with Databricks Runtime versions 3.0 or later.

cluster_name STRING Cluster name requested by the user. This doesn’t have to be unique. If not specified at creation, the cluster name will be an empty string.
spark_version STRING The Spark version of the cluster. A list of available Spark versions can be retrieved by using the Spark Versions API call. This field is required.
spark_conf SparkConfPair

An object containing a set of optional, user-specified Spark configuration key-value pairs. You can also pass in a string of extra JVM options to the driver and the executors via spark.driver.extraJavaOptions and spark.executor.extraJavaOptions respectively.

Example Spark confs: {"spark.speculation": true, "spark.streaming.ui.retainedBatches": 5} or {"spark.driver.extraJavaOptions": "-verbose:gc -XX:+PrintGCDetails"}

node_type_id STRING This field encodes, through a single value, the resources available to each of the Spark nodes in this cluster. For example, the Spark nodes can be provisioned and optimized for memory or compute intensive workloads A list of available node types can be retrieved by using the List Node Types API call. This field is required.
driver_node_type_id STRING The node type of the Spark driver. Note that this field is optional; if unset, the driver node type will be set as the same value as node_type_id defined above.
custom_tags An array of ClusterTag

Additional tags for cluster resources. Databricks will tag all cluster resources (e.g., VMs disk volumes) with these tags in addition to default_tags.

Azure Databricks allows up to 9 custom tags.

cluster_log_conf ClusterLogConf The configuration for delivering Spark logs to a long-term storage destination. Only one destination can be specified for one cluster. If the conf is given, the logs will be delivered to the destination every 5 mins. The destination of driver logs is <destination>/<cluster-id>/driver, while the destination of executor logs is <destination>/<cluster-id>/executor.
init_scripts An array of InitScriptInfo The configuration for storing init scripts. Any number of scripts can be specified. The scripts are executed sequentially in the order provided. If cluster_log_conf is specified, init script logs are sent to <destination>/<cluster-id>/init_scripts.
spark_env_vars of SparkEnvPair

An object containing a set of optional, user-specified environment variable key-value pairs. Key-value pairs of the form (X,Y) are exported as is (i.e., export X='Y') while launching the driver and workers.

In order to specify an additional set of SPARK_DAEMON_JAVA_OPTS, we recommend appending them to $SPARK_DAEMON_JAVA_OPTS as shown in the example below. This ensures that all default databricks managed environmental variables are included as well.

Example Spark environment variables: {"SPARK_WORKER_MEMORY": "28000m", "SPARK_LOCAL_DIRS": "/local_disk0"} or {"SPARK_DAEMON_JAVA_OPTS": "$SPARK_DAEMON_JAVA_OPTS -Dspark.shuffle.service.enabled=true"}

autotermination_minutes INT32 Automatically terminates the cluster after it is inactive for this time in minutes. If not set, this cluster will not be automatically terminated. If specified, the threshold must be between 10 and 10000 minutes. You can also set this value to 0 to explicitly disable automatic termination.
enable_elastic_disk BOOL Autoscaling Local Storage: when enabled, this cluster will dynamically acquire additional disk space when its Spark workers are running low on disk space. Refer to Autoscaling Local Storage for details.

Response Structure

Field Name Type Description
cluster_id STRING Canonical identifier for the cluster.

Edit

Endpoint HTTP Method
2.0/clusters/edit POST

Edits the configuration of a cluster to match the provided attributes and size.

A cluster can be edited if it is in a RUNNING or TERMINATED state. If a cluster is edited while in a RUNNING state, it will be restarted so that the new attributes can take effect. If a cluster is edited 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. An attempt to edit 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.

An example request:

{
  "cluster_id": "1202-211320-brick1",
  "num_workers": 10,
  "spark_version": "3.4.x-scala2.11",
  "node_type_id": "i3.2xlarge"
}

Request Structure

Field Name Type Description
num_workers OR autoscale INT32 OR AutoScale

If num_workers, number of worker nodes that this cluster should have. A cluster has one Spark Driver and num_workers Executors for a total of num_workers + 1 Spark nodes.

Note: When reading the properties of a cluster, this field reflects the desired number of workers rather than the actual current number of workers. For instance, if a cluster is resized from 5 to 10 workers, this field will immediately be updated to reflect the target size of 10 workers, whereas the workers listed in spark_info will gradually increase from 5 to 10 as the new nodes are provisioned.

If autoscale, parameters needed in order to automatically scale clusters up and down based on load. Note: autoscaling works best with Databricks Runtime versions 3.0 or later.

cluster_id STRING Canonical identifier for the cluster. This field is required.
cluster_name STRING Cluster name requested by the user. This doesn’t have to be unique. If not specified at creation, the cluster name will be an empty string.
spark_version STRING The Spark version of the cluster. A list of available Spark versions can be retrieved by using the Spark Versions API call. This field is required.
spark_conf SparkConfPair

An object containing a set of optional, user-specified Spark configuration key-value pairs. You can also pass in a string of extra JVM options to the driver and the executors via spark.driver.extraJavaOptions and spark.executor.extraJavaOptions respectively.

Example Spark confs: {"spark.speculation": true, "spark.streaming.ui.retainedBatches": 5} or {"spark.driver.extraJavaOptions": "-verbose:gc -XX:+PrintGCDetails"}

node_type_id STRING This field encodes, through a single value, the resources available to each of the Spark nodes in this cluster. For example, the Spark nodes can be provisioned and optimized for memory or compute intensive workloads A list of available node types can be retrieved by using the List Node Types API call. This field is required.
driver_node_type_id STRING The node type of the Spark driver. Note that this field is optional; if unset, the driver node type will be set as the same value as node_type_id defined above.
cluster_log_conf ClusterLogConf The configuration for delivering Spark logs to a long-term storage destination. Only one destination can be specified for one cluster. If the conf is given, the logs will be delivered to the destination every 5 mins. The destination of driver logs is <destination>/<cluster-id>/driver, while the destination of executor logs is <destination>/<cluster-id>/executor.
init_scripts An array of InitScriptInfo The configuration for storing init scripts. Any number of destinations can be specified. The scripts are executed sequentially in the order provided. If cluster_log_conf is specified, init script logs are sent to <destination>/<cluster-id>/init_scripts.
spark_env_vars SparkEnvPair

An object containing a set of optional, user-specified environment variable key-value pairs. Key-value pairs of the form (X,Y) are exported as is (i.e., export X='Y') while launching the driver and workers.

In order to specify an additional set of SPARK_DAEMON_JAVA_OPTS, we recommend appending them to $SPARK_DAEMON_JAVA_OPTS as shown in the example below. This ensures that all default databricks managed environmental variables are included as well.

Example Spark environment variables: {"SPARK_WORKER_MEMORY": "28000m", "SPARK_LOCAL_DIRS": "/local_disk0"} or {"SPARK_DAEMON_JAVA_OPTS": "$SPARK_DAEMON_JAVA_OPTS -Dspark.shuffle.service.enabled=true"}

autotermination_minutes INT32 Automatically terminates the cluster after it is inactive for this time in minutes. If not set, this cluster will not be automatically terminated. If specified, the threshold must be between 10 and 10000 minutes. You can also set this value to 0 to explicitly disable automatic termination.
enable_elastic_disk BOOL Autoscaling Local Storage: when enabled, this cluster will dynamically acquire additional disk space when its Spark workers are running low on disk space. Refer to Autoscaling Local Storage for details.

Start

Endpoint HTTP Method
2.0/clusters/start POST

Starts a terminated Spark cluster given its ID. This is 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 in a TERMINATED state, nothing will happen.
  • Clusters launched to run a job cannot be started.

An example request:

{
  "cluster_id": "1202-211320-brick1"
}

Request Structure

Field Name Type Description
cluster_id STRING The cluster to be started. This field is required.

Restart

Endpoint HTTP Method
2.0/clusters/restart POST

Restarts a Spark cluster given its id. If the cluster is not in a RUNNING state, nothing will happen.

An example request:

{
  "cluster_id": "1202-211320-brick1"
}

Request Structure

Field Name Type Description
cluster_id STRING The cluster to be started. This field is required.

Resize

Endpoint HTTP Method
2.0/clusters/resize POST

Resizes a cluster to have a desired number of workers. This will fail unless the cluster is in a RUNNING state.

An example request:

{
  "cluster_id": "1202-211320-brick1",
  "num_workers": 30
}

Request Structure

Field Name Type Description
num_workers OR autoscale INT32 OR AutoScale

If num_workers, number of worker nodes that this cluster should have. A cluster has one Spark Driver and num_workers Executors for a total of num_workers + 1 Spark nodes.

Note: When reading the properties of a cluster, this field reflects the desired number of workers rather than the actual current number of workers. For instance, if a cluster is resized from 5 to 10 workers, this field will immediately be updated to reflect the target size of 10 workers, whereas the workers listed in spark_info will gradually increase from 5 to 10 as the new nodes are provisioned.

If autoscale, parameters needed in order to automatically scale clusters up and down based on load. Note: autoscaling works best with Databricks Runtime versions 3.0 or later.

cluster_id STRING The cluster to be resized. This field is required.

Delete (Terminate)

Endpoint HTTP Method
2.0/clusters/delete POST

Terminates a Spark cluster given its 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.

An example request:

{
  "cluster_id": "1202-211320-brick1"
}

Request Structure

Field Name Type Description
cluster_id STRING The cluster to be terminated. This field is required.

Permanent Delete

Endpoint HTTP Method
2.0/clusters/permanent-delete POST

Permanently deletes a Spark cluster. If the cluster is running, it is terminated and its resources are asynchronously removed. If the cluster is terminated, then it is immediately removed.

You cannot perform any action on a permanently deleted cluster and a permanently deleted cluster is no longer returned in the cluster list.

An example request:

{
  "cluster_id": "1202-211320-brick1"
}

Request Structure

Field Name Type Description
cluster_id STRING The cluster to be permanently deleted. This field is required.

Get

Endpoint HTTP Method
2.0/clusters/get GET

Retrieves the information for a cluster given its identifier. Clusters can be described while they are running, or up to 30 days after they are terminated.

An example request:

/clusters/get?cluster_id=1202-211320-brick1

Request Structure

Field Name Type Description
cluster_id STRING The cluster about which to retrieve information. This field is required.

Response Structure

Field Name Type Description
num_workers OR autoscale INT32 OR AutoScale

If num_workers, number of worker nodes that this cluster should have. A cluster has one Spark Driver and num_workers Executors for a total of num_workers + 1 Spark nodes.

Note: When reading the properties of a cluster, this field reflects the desired number of workers rather than the actual current number of workers. For instance, if a cluster is resized from 5 to 10 workers, this field will immediately be updated to reflect the target size of 10 workers, whereas the workers listed in spark_info will gradually increase from 5 to 10 as the new nodes are provisioned.

If autoscale, parameters needed in order to automatically scale clusters up and down based on load. Note: autoscaling works best with Databricks Runtime versions 3.0 or later.

cluster_id STRING Canonical identifier for the cluster. This id is retained during cluster restarts and resizes, while each new cluster has a globally unique id.
creator_user_name STRING Creator user name. The field won’t be included in the response if the user has already been deleted.
driver SparkNode Node on which the Spark driver resides. The driver node contains the Spark master and the Databricks application that manages the per-notebook Spark REPLs.
executors An array of SparkNode Nodes on which the Spark executors reside.
spark_context_id INT64 A canonical SparkContext identifier. This value does change when the Spark driver restarts. The pair (cluster_id, spark_context_id) is a globally unique identifier over all Spark contexts.
jdbc_port INT32 Port on which Spark JDBC server is listening, in the driver nod. No service will be listening on on this port in executor nodes.
cluster_name STRING Cluster name requested by the user. This doesn’t have to be unique. If not specified at creation, the cluster name will be an empty string.
spark_version STRING The Spark version of the cluster. A list of available Spark versions can be retrieved by using the Spark Versions API call.
spark_conf SparkConfPair

An object containing a set of optional, user-specified Spark configuration key-value pairs. You can also pass in a string of extra JVM options to the driver and the executors via spark.driver.extraJavaOptions and spark.executor.extraJavaOptions respectively.

Example Spark confs: {"spark.speculation": true, "spark.streaming.ui.retainedBatches": 5} or {"spark.driver.extraJavaOptions": "-verbose:gc -XX:+PrintGCDetails"}

node_type_id STRING This field encodes, through a single value, the resources available to each of the Spark nodes in this cluster. For example, the Spark nodes can be provisioned and optimized for memory or compute intensive workloads A list of available node types can be retrieved by using the List Node Types API call. This field is required.
driver_node_type_id STRING The node type of the Spark driver. Note that this field is optional; if unset, the driver node type will be set as the same value as node_type_id defined above.
cluster_log_conf ClusterLogConf The configuration for delivering Spark logs to a long-term storage destination. Only one destination can be specified for one cluster. If the conf is given, the logs will be delivered to the destination every 5 mins. The destination of driver logs is <destination>/<cluster-id>/driver, while the destination of executor logs is <destination>/<cluster-id>/executor.
init_scripts An array of InitScriptInfo The configuration for storing init scripts. Any number of destinations can be specified. The scripts are executed sequentially in the order provided. If cluster_log_conf is specified, init script logs are sent to <destination>/<cluster-id>/init_scripts.
spark_env_vars SparkEnvPair

An object containing a set of optional, user-specified environment variable key-value pairs. Key-value pairs of the form (X,Y) are exported as is (i.e., export X='Y') while launching the driver and workers.

In order to specify an additional set of SPARK_DAEMON_JAVA_OPTS, we recommend appending them to $SPARK_DAEMON_JAVA_OPTS as shown in the example below. This ensures that all default databricks managed environmental variables are included as well.

Example Spark environment variables: {"SPARK_WORKER_MEMORY": "28000m", "SPARK_LOCAL_DIRS": "/local_disk0"} or {"SPARK_DAEMON_JAVA_OPTS": "$SPARK_DAEMON_JAVA_OPTS -Dspark.shuffle.service.enabled=true"}

autotermination_minutes INT32 Automatically terminates the cluster after it is inactive for this time in minutes. If not set, this cluster will not be automatically terminated. If specified, the threshold must be between 10 and 10000 minutes. You can also set this value to 0 to explicitly disable automatic termination.
enable_elastic_disk BOOL Autoscaling Local Storage: when enabled, this cluster will dynamically acquire additional disk space when its Spark workers are running low on disk space. Refer to Autoscaling Local Storage for details.
state ClusterState Current state of the cluster.
state_message STRING A message associated with the most recent state transition (e.g., the reason why the cluster entered a TERMINATED state).
start_time INT64 Time (in epoch milliseconds) when the cluster creation request was received (when the cluster entered a PENDING state).
terminated_time INT64 Time (in epoch milliseconds) when the cluster was terminated, if applicable.
last_state_loss_time INT64 Time when the cluster driver last lost its state (due to a restart or driver failure).
last_activity_time INT64 Time (in epoch milliseconds) when the cluster was last active. A cluster is active if there is at least one command that has not finished on the cluster. This field is available after the cluster has reached a RUNNING state. Updates to this field are made as best-effort attempts. Certain versions of Spark do not support reporting of cluster activity. Refer to Automatic termination for details.
cluster_memory_mb INT64 Total amount of cluster memory, in megabytes.
cluster_cores FLOAT Number of CPU cores available for this cluster. Note that this can be fractional, e.g. 7.5 cores, since certain node types are configured to share cores between Spark nodes on the same instance.
cluster_log_status LogSyncStatus Cluster log delivery status.
termination_reason TerminationReason Information about why the cluster was terminated. This field only appears when the cluster is in a TERMINATING or TERMINATED state.

Pin

Note

You must be an Azure Databricks administrator to invoke this API.

Endpoint HTTP Method
2.0/clusters/pin POST

Pinning a cluster ensures that the cluster is always returned by the List API. Pinning a cluster that is already pinned has no effect.

An example request:

{
  "cluster_id": "1202-211320-brick1"
}

Request Structure

Field Name Type Description
cluster_id STRING The cluster to pin. This field is required.

Unpin

Note

You must be an Azure Databricks administrator to invoke this API.

Endpoint HTTP Method
2.0/clusters/unpin POST

Unpinning a cluster will allow the cluster to eventually be removed from the list returned by the List API. Unpinning a cluster that is not pinned has no effect.

An example request:

{
  "cluster_id": "1202-211320-brick1"
}

Request Structure

Field Name Type Description
cluster_id STRING The cluster to unpin. This field is required.

List

Endpoint HTTP Method
2.0/clusters/list GET

Returns information about all pinned clusters, currently active clusters, up to 70 of the most recently terminated interactive clusters in the past 30 days, and up to 30 of the most recently terminated job clusters in the past 30 days. For example, if there is 1 pinned cluster, 4 active clusters, 45 terminated interactive clusters in the past 30 days, and 50 terminated job clusters in the past 30 days, then this API returns the 1 pinned cluster, 4 active clusters, all 45 terminated interactive clusters, and the 30 most recently terminated job clusters.

Response Structure

Field Name Type Description
clusters An array of ClusterInfo A list of clusters.

List Node Types

Endpoint HTTP Method
2.0/clusters/list-node-types GET

Returns a list of supported Spark node types. These node types can be used to launch a cluster.

Response Structure

Field Name Type Description
node_types An array of NodeType The list of available Spark node types.

Spark Versions

Endpoint HTTP Method
2.0/clusters/spark-versions GET

Returns the list of available Spark versions. These versions can be used to launch a cluster.

Response Structure

Field Name Type Description
versions An array of SparkVersion All the available Spark versions.

Events

Endpoint HTTP Method
2.0/clusters/events POST

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.

An example request:

{
  "cluster_id": "1202-211320-brick1"
}

An example response:

{
  "events": [{
    "cluster_id": "1202-211320-brick1",
    "timestamp": 1534371918659,
    "type": "TERMINATING",
    "details": {
      "reason": {
        "code": "INACTIVITY",
        "parameters": {
          "inactivity_duration_min": "120"
        }
      }
    }
  }, {
    "cluster_id": "1202-211320-brick1",
    "timestamp": 1534358289590,
    "type": "RUNNING",
    "details": {
      "current_num_workers": 2,
      "target_num_workers": 2
    }
  }, {
    "cluster_id": "1202-211320-brick1",
    "timestamp": 1533225298406,
    "type": "RESTARTING",
    "details": {
      "user": "admin"
    }
  }],
  "next_page": {
    "cluster_id": "0802-034608-aloe926",
    "end_time": 1534371918659,
    "offset": 50
  },
  "total_count": 55
}

Example request to retrieve the next page of events:

{
  "cluster_id": "1202-211320",
  "start_time": 1534371918659
}

Request Structure

Retrieves events pertaining to a specific cluster.

Field Name Type Description
cluster_id STRING The ID of the cluster to retrieve events about. This field is required.
start_time INT64 The start time in epoch milliseconds. If empty, returns events starting from the beginning of time.
end_time INT64 The end time in epoch milliseconds. If empty, returns events up to the current time.
order ListOrder The order to list events in; either ASC or DESC. Defaults to DESC.
event_types An array of ClusterEventType An optional set of event types to filter on. If empty, all event types are returned.
offset INT64 The offset in the result set. Defaults to 0 (no offset). When an offset is specified and the results are requested in descending order, the end_time field is required.
limit INT64 The maximum number of events to include in a page of events. Defaults to 50, and maximum allowed value is 500.

Response Structure

Field Name Type Description
events An array of ClusterEvent This list of matching events.
next_page Request Structure The parameters required to retrieve the next page of events. Omitted if there are no more events to read.
total_count INT64 The total number of events filtered by the start_time, end_time, and event_types.

Data Structures

AutoScale

Field Name Type Description
min_workers INT32 The minimum number of workers to which the cluster can scale down when underutilized. It is also the initial number of workers the cluster will have after creation.
max_workers INT32 The maximum number of workers to which the cluster can scale up when overloaded. Note that max_workers must be strictly greater than min_workers.

ClusterInfo

Describes all of the metadata about a single Spark cluster in Azure Databricks.

Field Name Type Description
num_workers OR autoscale INT32 OR AutoScale

If num_workers, number of worker nodes that this cluster should have. A cluster has one Spark Driver and num_workers Executors for a total of num_workers + 1 Spark nodes.

Note: When reading the properties of a cluster, this field reflects the desired number of workers rather than the actual current number of workers. For instance, if a cluster is resized from 5 to 10 workers, this field will immediately be updated to reflect the target size of 10 workers, whereas the workers listed in spark_info will gradually increase from 5 to 10 as the new nodes are provisioned.

If autoscale, parameters needed in order to automatically scale clusters up and down based on load. Note: autoscaling works best with Databricks Runtime versions 3.0 or later.

cluster_id STRING Canonical identifier for the cluster. This id is retained during cluster restarts and resizes, while each new cluster has a globally unique id.
creator_user_name STRING Creator user name. The field won’t be included in the response if the user has already been deleted.
driver SparkNode Node on which the Spark driver resides. The driver node contains the Spark master and the Databricks application that manages the per-notebook Spark REPLs.
executors An array of SparkNode Nodes on which the Spark executors reside.
spark_context_id INT64 A canonical SparkContext identifier. This value does change when the Spark driver restarts. The pair (cluster_id, spark_context_id) is a globally unique identifier over all Spark contexts.
jdbc_port INT32 Port on which Spark JDBC server is listening, in the driver nod. No service will be listening on on this port in executor nodes.
cluster_name STRING Cluster name requested by the user. This doesn’t have to be unique. If not specified at creation, the cluster name will be an empty string.
spark_version STRING The Spark version of the cluster. A list of available Spark versions can be retrieved by using the Spark Versions API call.
spark_conf SparkConfPair

An object containing a set of optional, user-specified Spark configuration key-value pairs. You can also pass in a string of extra JVM options to the driver and the executors via spark.driver.extraJavaOptions and spark.executor.extraJavaOptions respectively.

Example Spark confs: {"spark.speculation": true, "spark.streaming.ui.retainedBatches": 5} or {"spark.driver.extraJavaOptions": "-verbose:gc -XX:+PrintGCDetails"}

node_type_id STRING This field encodes, through a single value, the resources available to each of the Spark nodes in this cluster. For example, the Spark nodes can be provisioned and optimized for memory or compute intensive workloads A list of available node types can be retrieved by using the List Node Types API call.
driver_node_type_id STRING The node type of the Spark driver. Note that this field is optional; if unset, the driver node type will be set as the same value as node_type_id defined above.
cluster_log_conf ClusterLogConf The configuration for delivering Spark logs to a long-term storage destination. Only one destination can be specified for one cluster. If the conf is given, the logs will be delivered to the destination every 5 mins. The destination of driver logs is <destination>/<cluster-id>/driver, while the destination of executor logs is <destination>/<cluster-id>/executor.
init_scripts An array of InitScriptInfo The configuration for storing init scripts. Any number of destinations can be specified. The scripts are executed sequentially in the order provided. If cluster_log_conf is specified, init script logs are sent to <destination>/<cluster-id>/init_scripts.
spark_env_vars SparkEnvPair

An object containing a set of optional, user-specified environment variable key-value pairs. Key-value pairs of the form (X,Y) are exported as is (i.e., export X='Y') while launching the driver and workers.

In order to specify an additional set of SPARK_DAEMON_JAVA_OPTS, we recommend appending them to $SPARK_DAEMON_JAVA_OPTS as shown in the example below. This ensures that all default databricks managed environmental variables are included as well.

Example Spark environment variables: {"SPARK_WORKER_MEMORY": "28000m", "SPARK_LOCAL_DIRS": "/local_disk0"} or {"SPARK_DAEMON_JAVA_OPTS": "$SPARK_DAEMON_JAVA_OPTS -Dspark.shuffle.service.enabled=true"}

autotermination_minutes INT32 Automatically terminates the cluster after it is inactive for this time in minutes. If not set, this cluster will not be automatically terminated. If specified, the threshold must be between 10 and 10000 minutes. You can also set this value to 0 to explicitly disable automatic termination.
state ClusterState Current state of the cluster.
state_message STRING A message associated with the most recent state transition (e.g., the reason why the cluster entered a TERMINATED state).
start_time INT64 Time (in epoch milliseconds) when the cluster creation request was received (when the cluster entered a PENDING state).
terminated_time INT64 Time (in epoch milliseconds) when the cluster was terminated, if applicable.
last_state_loss_time INT64 Time when the cluster driver last lost its state (due to a restart or driver failure).
last_activity_time INT64 Time (in epoch milliseconds) when the cluster was last active. A cluster is active if there is at least one command that has not finished on the cluster. This field is available after the cluster has reached a RUNNING state. Updates to this field are made as best-effort attempts. Certain versions of Spark do not support reporting of cluster activity. Refer to Automatic termination for details.
cluster_memory_mb INT64 Total amount of cluster memory, in megabytes.
cluster_cores FLOAT Number of CPU cores available for this cluster. Note that this can be fractional, e.g. 7.5 cores, since certain node types are configured to share cores between Spark nodes on the same instance.
default_tags An array of ClusterTag

Tags that are added by Databricks by default, regardless of any custom_tags that may have been added. These include:

  • Vendor: Databricks
  • Creator: <username_of_creator>
  • ClusterName: <name_of_cluster>
  • ClusterId: <id_of_cluster>
  • Environment: <Databricks internal use>
  • databricks-instance-name: <Databricks internal use>
cluster_log_status LogSyncStatus Cluster log delivery status.
termination_reason TerminationReason Information about why the cluster was terminated. This field only appears when the cluster is in a TERMINATING or TERMINATED state.

ClusterEvent

Field Name Type Description
cluster_id STRING Canonical identifier for the cluster. This field is required.
timestamp INT64 The timestamp when the event occurred, stored as the number of milliseconds since the unix epoch. Assigned by the Timeline service.
type ClusterEventType The event type. This field is required.
details EventDetails The event details. This field is required.

ClusterEventType

Event Type Description
CREATING Indicates that the cluster is being created.
DID_NOT_EXPAND_DISK Indicates that a disk is low on space, but adding disks would put it over the max capacity.
EXPANDED_DISK Indicates that a disk was low on space and the disks were expanded.
FAILED_TO_EXPAND_DISK Indicates that a disk was low on space and disk space could not be expanded.
INIT_SCRIPTS_STARTING Indicates that the cluster scoped init script has started.
INIT_SCRIPTS_FINISHED Indicates that the cluster scoped init script has finished.
STARTING Indicates that the cluster is being started.
RESTARTING Indicates that the cluster is being started.
TERMINATING Indicates that the cluster is being terminated.
EDITED Indicates that the cluster has been edited.
RUNNING Indicates the cluster finished creating, starting, or restarting. Includes the number of nodes in the cluster and a failure reason if some nodes could not be acquired.
RESIZING Indicates a change in the target size of the cluster (upsize or downsize).
UPSIZE_COMPLETED Indicates that nodes finished being added to the cluster. Includes the number of nodes in the cluster and a failure reason if some nodes could not be acquired.
NODES_LOST Indicates that some nodes were lost from the cluster.

EventDetails

Field Name Type Description
current_num_workers INT32 The current number of nodes in the cluster.
target_num_workers INT32 The targeted number of nodes in the cluster.
previous_attributes ClusterAttributes The cluster attributes before a cluster was edited.
attributes ClusterAttributes
  • For created clusters, the attributes of the cluster.
  • For edited clusters, the new attributes of the cluster.
previous_cluster_size ClusterSize The size of the cluster before an edit or resize.
cluster_size ClusterSize The cluster size that was set in the cluster creation or edit.
cause ResizeCause The cause of a change in target size.
reason TerminationReason

A termination reason:

  • On a TERMINATED event, the reason for the termination.
  • On a RESIZE_COMPLETE event, indicates the reason that we failed to acquire some nodes.
user STRING The user that caused the event to occur. (Empty if it was done by Azure Databricks.)

ClusterAttributes

Common set of attributes set during cluster creation. These attributes cannot be changed over the lifetime of a cluster.

Field Name Type Description
cluster_name STRING Cluster name requested by the user. This doesn’t have to be unique. If not specified at creation, the cluster name will be an empty string.
spark_version STRING The Spark version of the cluster, e.g. “3.5.x-scala2.11”. A list of available Spark versions can be retrieved by using the Spark Versions API call.
spark_conf SparkConfPair

An object containing a set of optional, user-specified Spark configuration key-value pairs. You can also pass in a string of extra JVM options to the driver and the executors via spark.driver.extraJavaOptions and spark.executor.extraJavaOptions respectively.

Example Spark confs: {"spark.speculation": true, "spark.streaming.ui.retainedBatches": 5} or {"spark.driver.extraJavaOptions": "-verbose:gc -XX:+PrintGCDetails"}

node_type_id STRING This field encodes, through a single value, the resources available to each of the Spark nodes in this cluster. For example, the Spark nodes can be provisioned and optimized for memory or compute intensive workloads A list of available node types can be retrieved by using the List Node Types API call.
driver_node_type_id STRING The node type of the Spark driver. Note that this field is optional; if unset, the driver node type will be set as the same value as node_type_id defined above.
ssh_public_keys An array of STRING SSH public key contents that will be added to each Spark node in this cluster. The corresponding private keys can be used to login with the user name ubuntu on port 2200. Up to 10 keys can be specified.
custom_tags An array of ClusterTag

Additional tags for cluster resources. Databricks will tag all cluster resources with these tags in addition to default_tags. Notes:

  • Tags are not supported on legacy node types such as compute-optimized and memory-optimized
  • Databricks allows at most 45 custom tags
cluster_log_conf ClusterLogConf The configuration for delivering Spark logs to a long-term storage destination. Only one destination can be specified for one cluster. If the conf is given, the logs will be delivered to the destination every 5 mins. The destination of driver logs is <destination>/<cluster-id>/driver, while the destination of executor logs is <destination>/<cluster-id>/executor.
init_scripts An array of InitScriptInfo The configuration for storing init scripts. Any number of destinations can be specified. The scripts are executed sequentially in the order provided. If cluster_log_conf is specified, init script logs are sent to <destination>/<cluster-id>/init_scripts.
spark_env_vars SparkEnvPair

An object containing a set of optional, user-specified environment variable key-value pairs. Key-value pairs of the form (X,Y) are exported as is (i.e., export X='Y') while launching the driver and workers.

In order to specify an additional set of SPARK_DAEMON_JAVA_OPTS, we recommend appending them to $SPARK_DAEMON_JAVA_OPTS as shown in the example below. This ensures that all default databricks managed environmental variables are included as well.

Example Spark environment variables: {"SPARK_WORKER_MEMORY": "28000m", "SPARK_LOCAL_DIRS": "/local_disk0"} or {"SPARK_DAEMON_JAVA_OPTS": "$SPARK_DAEMON_JAVA_OPTS -Dspark.shuffle.service.enabled=true"}

autotermination_minutes INT32 Automatically terminates the cluster after it is inactive for this time in minutes. If not set, this cluster will not be automatically terminated. If specified, the threshold must be between 10 and 10000 minutes. You can also set this value to 0 to explicitly disable automatic termination.
enable_elastic_disk BOOL Autoscaling Local Storage: when enabled, this cluster will dynamically acquire additional disk space when its Spark workers are running low on disk space. Refer to Autoscaling Local Storage for details.
cluster_source ClusterSource Determines whether the cluster was created by a user through the UI, created by the Databricks Jobs Scheduler, or through an API request.

ClusterSize

Field Name Type Description
num_workers OR autoscale INT32 OR AutoScale

If num_workers, number of worker nodes that this cluster should have. A cluster has one Spark Driver and num_workers Executors for a total of num_workers + 1 Spark nodes.

When reading the properties of a cluster, this field reflects the desired number of workers rather than the actual current number of workers. For instance, if a cluster is resized from 5 to 10 workers, this field will immediately be updated to reflect the target size of 10 workers, whereas the workers listed in spark_info will gradually increase from 5 to 10 as the new nodes are provisioned.

If autoscale, parameters needed in order to automatically scale clusters up and down based on load. Note: autoscaling works best with Databricks Runtime versions 3.0 or later.

ListOrder

A generic ordering enum for list-based queries.

Order Description
DESC Descending order
ASC Ascending order

ResizeCause

Cause Description
AUTOSCALE Automatically resized based on load.
USER_REQUEST User requested a new size.
AUTORECOVERY Autorecovery monitor resized the cluster after it lost a node.

ClusterLogConf

Field Name Type Description
dbfs DbfsStorageInfo DBFS location of cluster log. destination must be provided. For example, { "dbfs" : { "destination" : "dbfs:/home/cluster_log" } }

InitScriptInfo

Field Name Type Description
dbfs DbfsStorageInfo DBFS location of init script. destination must be provided. For example, { "dbfs" : { "destination" : "dbfs:/home/init_script" } }

ClusterTag

Field Name Type Description
key STRING

The key of the tag. The key must:

  • Be between 1 and 512 characters long
  • Not contain any of the characters <>%*&+?\\/
  • Not begin with azure, microsoft, or windows
value STRING The value of the tag. The value length must be less than or equal to 256 UTF-8 characters.

DbfsStorageInfo

DBFS storage information.

Field Name Type Description
destination STRING DBFS destination, e.g. dbfs:/my/path

LogSyncStatus

The log delivery status.

Field Name Type Description
last_attempted INT64 The timestamp of last attempt. If the last attempt fails, last_exception will contain the exception in the last attempt.
last_exception STRING The exception thrown in the last attempt, it would be null (omitted in the response) if there is no exception in last attempted.

NodeType

A description of a Spark node type including both the dimensions of the node and the instance type on which it will be hosted.

Field Name Type Description
node_type_id STRING Unique identifier for this node type. This field is required.
memory_mb INT32 Memory (in MB) available for this node type. This field is required.
num_cores FLOAT Number of CPU cores available for this node type. This can be fractional, e.g., 2.5 cores, if the the number of cores on a machine instance is not divisible by the number of Spark nodes on that machine. This field is required.
description STRING A string description associated with this node type. This field is required.
instance_type_id STRING An identifier for the type of hardware that this node runs on. This field is required.
is_deprecated BOOL Whether the node type is deprecated. Non-deprecated node types offer greater performance.
node_info ClusterCloudProviderNodeInfo Node type info reported by the cloud provider.

ClusterCloudProviderNodeInfo

Field Name Type Description
status ClusterCloudProviderNodeStatus Status as reported by the cloud provider.
available_core_quota INT32 Available CPU core quota.
total_core_quota INT32 Total CPU core quota.

ClusterCloudProviderNodeStatus

Status Description
NotEnabledOnSubscription Node type not available for subscription.
NotAvailableInRegion Node type not available in region.

ParameterPair

Field Name Type Description
key TerminationParameter Type of termination information.
value STRING The termination information.

SparkConfPair

Spark configuration key-value pairs.

Field Name Type Description
key STRING The configuration property name.
value STRING The configuration property value.

SparkEnvPair

Spark environment variable key-value pairs.

Field Name Type Description
key STRING The environment variable name.
value STRING The environment variable value.

SparkNode

A specific Spark driver or executor.

Field Name Type Description
private_ip STRING Private IP address (typically a 10.x.x.x address) of the Spark node. Note that this is different from the private IP address of the host instance.
public_dns STRING Public DNS address of this node. This address can be used to access the Spark JDBC server on the driver node.
node_id STRING Globally unique identifier for this node.
instance_id STRING Globally unique identifier for the host instance from the cloud provider.
start_timestamp INT64 The timestamp (in millisecond) when the Spark node is launched.
host_private_ip STRING The private IP address of the host instance.

SparkVersion

Field Name Type Description
key STRING Databricks Runtime version key, for example 4.0.x-scala2.11. The value that should be provided as the spark_version when creating a new cluster. The exact Spark version may change over time for a “wildcard” version (that is, 4.0.x-scala2.11 is a “wildcard” version) with minor bug fixes.
name STRING A descriptive name for the Spark version, for example “Spark 2.3”.

TerminationReason

Field Name Type Description
code TerminationCode Status code indicating why the cluster was terminated.
parameters An array of ParameterPair List of parameters that provide additional information about why the cluster was terminated.

ClusterSource

The service that created the cluster.

Service Description
UI Cluster created through the UI.
JOB Cluster created by the Databricks Job Scheduler.
API Cluster created through an API call.

ClusterState

The state of a cluster. The current allowable state transitions are as follows:

  • PENDING -> RUNNING
  • PENDING -> TERMINATING
  • RUNNING -> RESIZING
  • RUNNING -> RESTARTING
  • RUNNING -> TERMINATING
  • RESTARTING -> RUNNING
  • RESTARTING -> TERMINATING
  • RESIZING -> RUNNING
  • RESIZING -> TERMINATING
  • TERMINATING -> TERMINATED
State Description
PENDING Indicates that a cluster is in the process of being created.
RUNNING Indicates that a cluster has been started and is ready for use.
RESTARTING Indicates that a cluster is in the process of restarting.
RESIZING Indicates that a cluster is in the process of adding or removing nodes.
TERMINATING Indicates that a cluster is in the process of being destroyed.
TERMINATED Indicates that a cluster has been successfully destroyed.
ERROR This state is not used anymore. It was used to indicate a cluster that failed to be created. Terminating and Terminated are used instead.
UNKNOWN Indicates that a cluster is in an unknown state. A cluster should never be in this state.

TerminationCode

The status code indicating why the cluster was terminated.

Code Description
USER_REQUEST A user terminated the cluster directly. Parameters should include a username field that indicates the specific user who terminated the cluster.
JOB_FINISHED This cluster was launched by a job, and terminated when the job completed.
INACTIVITY This cluster was terminated since it was idle.
CLOUD_PROVIDER_SHUTDOWN The instance that hosted the Spark driver was terminated by the cloud provider.
COMMUNICATION_LOST Azure Databricks lost connection to services on the driver instance. For example, this can happen when problems arise in cloud networking infrastructure, or when the instance itself becomes unhealthy.
CLOUD_PROVIDER_LAUNCH_FAILURE Azure Databricks experienced a cloud provider failure when requesting instances to launch clusters.
SPARK_STARTUP_FAILURE The Spark driver failed to start. Possible reasons may include incompatible libraries and initialization scripts that corrupted the Spark container.
INVALID_ARGUMENT Cannot launch the cluster because the user specified an invalid argument. For example, the user might specify an invalid Spark version for the cluster.
UNEXPECTED_LAUNCH_FAILURE While launching this cluster, Azure Databricks failed to complete critical setup steps, terminating the cluster.
INTERNAL_ERROR Azure Databricks encountered an unexpected error that forced the running cluster to be terminated. Contact Azure Databricks support for additional details.
INSTANCE_UNREACHABLE Azure Databricks was not able to access instances in order to start the cluster. This can be a transient networking issue. If the problem persists, this usually indicates a networking environment misconfiguration.
REQUEST_REJECTED Azure Databricks cannot handle the request at this moment. Try again later and contact Azure Databricks if the problem persists.
INIT_SCRIPT_FAILURE The init script for the driver container failed, causing cluster creation to fail.
TRIAL_EXPIRED The Azure Databricks trial subscription expired.

TerminationParameter

Key that provides additional information about why a cluster was terminated.

Key Description
username The username of the user who terminated the cluster.
databricks_error_message Additional context that may explain the reason for cluster termination.
inactivity_duration_min An idle cluster was shut down after being inactive for this duration.
instance_id The id of the instance that was hosting the Spark driver.
azure_error_code The Azure provided error code describing why cluster nodes could not be provisioned. For reference, see: https://docs.microsoft.com/en-us/azure/virtual-machines/windows/error-messages.
azure_error_message Human-readable context of various failures from Azure.