@@ -8,14 +8,15 @@ import Time from "../../retries/Time";
88import retry from "../../retries/retries" ;
99import { CancellationToken } from "../../types" ;
1010import { ApiError , ApiRetriableError } from "../apiError" ;
11+
1112export class ClustersRetriableError extends ApiRetriableError {
1213 constructor ( method : string , message ?: string ) {
13- super ( "$s.PascalName " , method , message ) ;
14+ super ( "Clusters " , method , message ) ;
1415 }
1516}
1617export class ClustersError extends ApiError {
1718 constructor ( method : string , message ?: string ) {
18- super ( "$s.PascalName " , method , message ) ;
19+ super ( "Clusters " , method , message ) ;
1920 }
2021}
2122
@@ -25,8 +26,10 @@ export class ClustersError extends ApiError {
2526export class ClustersService {
2627 constructor ( readonly client : ApiClient ) { }
2728 /**
28- * Public version of editClusterOwner, allowing admins to change cluster
29- * owner
29+ * Change cluster owner
30+ *
31+ * Change the owner of the cluster. You must be an admin to perform this
32+ * operation.
3033 */
3134 async changeOwner (
3235 request : model . ChangeClusterOwner ,
@@ -42,24 +45,21 @@ export class ClustersService {
4245 }
4346
4447 /**
48+ * Create new cluster
49+ *
4550 * Creates a new Spark cluster. This method will acquire new instances from
4651 * the cloud provider if necessary. This method is asynchronous; the returned
4752 * ``cluster_id`` can be used to poll the cluster status. When this method
48- * returns, the cluster will be in a ``PENDING`` state. The cluster will be
49- * usable once it enters a ``RUNNING`` state. Note: Databricks may not be
50- * able to acquire some of the requested nodes, due to cloud provider
51- * limitations (account limits, spot price, ...) or transient network issues.
53+ * returns, the cluster will be in\na ``PENDING`` state. The cluster will be
54+ * usable once it enters a ``RUNNING`` state.
55+ *
56+ * Note: Databricks may not be able to acquire some of the requested nodes,
57+ * due to cloud provider limitations (account limits, spot price, etc.) or
58+ * transient network issues.
59+ *
5260 * If Databricks acquires at least 85% of the requested on-demand nodes,
5361 * cluster creation will succeed. Otherwise the cluster will terminate with
54- * an informative error message. An example request: .. code:: {
55- * "cluster_name": "my-cluster", "spark_version": "2.0.x-scala2.10",
56- * "node_type_id": "r3.xlarge", "spark_conf": { "spark.speculation": true },
57- * "aws_attributes": { "availability": "SPOT", "zone_id": "us-west-2a" },
58- * "num_workers": 25 } See below as an example for an autoscaling cluster.
59- * Note that this cluster will start with `2` nodes, the minimum. .. code:: {
60- * "cluster_name": "autoscaling-cluster", "spark_version": "2.0.x-scala2.10",
61- * "node_type_id": "r3.xlarge", "autoscale" : { "min_workers": 2,
62- * "max_workers": 50 } }
62+ * an informative error message.
6363 */
6464 async create (
6565 request : model . CreateCluster ,
@@ -128,11 +128,12 @@ export class ClustersService {
128128 }
129129
130130 /**
131- * Terminates a Spark cluster given its id. The cluster is removed
131+ * Terminate cluster
132+ *
133+ * Terminates the Spark cluster with the specified ID. The cluster is removed
132134 * asynchronously. Once the termination has completed, the cluster will be in
133135 * a ``TERMINATED`` state. If the cluster is already in a ``TERMINATING`` or
134- * ``TERMINATED`` state, nothing will happen. An example request: .. code:: {
135- * "cluster_id": "1202-211320-brick1" }
136+ * ``TERMINATED`` state, nothing will happen.
136137 */
137138 async delete (
138139 request : model . DeleteCluster ,
@@ -201,17 +202,21 @@ export class ClustersService {
201202 }
202203
203204 /**
204- * Edits the configuration of a cluster to match the provided attributes and
205- * size. A cluster can be edited if it is in a ``RUNNING`` or ``TERMINATED``
206- * state. If a cluster is edited while in a ``RUNNING`` state, it will be
207- * restarted so that the new attributes can take effect. If a cluster is
208- * edited while in a ``TERMINATED`` state, it will remain ``TERMINATED``. The
209- * next time it is started using the ``clusters/start`` API, the new
210- * attributes will take effect. An attempt to edit a cluster in any other
211- * state will be rejected with an ``INVALID_STATE`` error code. Clusters
212- * created by the Databricks Jobs service cannot be edited. An example
213- * request: .. code:: { "cluster_id": "1202-211320-brick1", "num_workers":
214- * 10, "spark_version": "3.3.x-scala2.11", "node_type_id": "i3.2xlarge" }
205+ * Update cluster configuration
206+ *
207+ * Updates the configuration of a cluster to match the provided attributes
208+ * and size. A cluster can be updated if it is in a ``RUNNING`` or
209+ * ``TERMINATED`` state.
210+ *
211+ * If a cluster is updated while in a ``RUNNING`` state, it will be restarted
212+ * so that the new attributes can take effect.
213+ *
214+ * If a cluster is updated while in a ``TERMINATED`` state, it will remain
215+ * ``TERMINATED``. The next time it is started using the ``clusters/start``
216+ * API, the new attributes will take effect. Any attempt to update a cluster
217+ * in any other state will be rejected with an ``INVALID_STATE`` error code.
218+ *
219+ * Clusters created by the Databricks Jobs service cannot be edited.
215220 */
216221 async edit (
217222 request : model . EditCluster ,
@@ -280,20 +285,11 @@ export class ClustersService {
280285 }
281286
282287 /**
288+ * List cluster activity events
289+ *
283290 * Retrieves a list of events about the activity of a cluster. This API is
284291 * paginated. If there are more events to read, the response includes all the
285- * parameters necessary to request the next page of events. An example
286- * request: ``/clusters/events?cluster_id=1202-211320-brick1`` An example
287- * response: { "events": [ { "cluster_id": "1202-211320-brick1", "timestamp":
288- * 1509572145487, "event_type": "RESTARTING", "event_details": { "username":
289- * "admin" } }, ... { "cluster_id": "1202-211320-brick1", "timestamp":
290- * 1509505807923, "event_type": "TERMINATING", "event_details": {
291- * "termination_reason": { "code": "USER_REQUEST", "parameters": [
292- * "username": "admin" ] } } ], "next_page": { "cluster_id":
293- * "1202-211320-brick1", "end_time": 1509572145487, "order": "DESC",
294- * "offset": 50 }, "total_count": 303 } Example request to retrieve the next
295- * page of events
296- * ``/clusters/events?cluster_id=1202-211320-brick1&end_time=1509572145487&order=DESC&offset=50``
292+ * nparameters necessary to request the next page of events.
297293 */
298294 async events (
299295 request : model . GetEvents ,
@@ -309,10 +305,11 @@ export class ClustersService {
309305 }
310306
311307 /**
312- * Retrieves the information for a cluster given its identifier. Clusters can
313- * be described while they are running, or up to 60 days after they are
314- * terminated. An example request:
315- * ``/clusters/get?cluster_id=1202-211320-brick1``
308+ * Get cluster info
309+ *
310+ * "Retrieves the information for a cluster given its identifier. Clusters
311+ * can be described while they are running, or up to 60 days after they are
312+ * terminated.
316313 */
317314 async get (
318315 request : model . GetRequest ,
@@ -381,14 +378,18 @@ export class ClustersService {
381378 }
382379
383380 /**
381+ * List all clusters
382+ *
384383 * Returns information about all pinned clusters, currently active clusters,
385384 * up to 70 of the most recently terminated interactive clusters in the past
386385 * 7 days, and up to 30 of the most recently terminated job clusters in the
387- * past 7 days. For example, if there is 1 pinned cluster, 4 active clusters,
388- * 45 terminated interactive clusters in the past 7 days, and 50 terminated
389- * job clusters in the past 7 days, then this API returns the 1 pinned
390- * cluster, 4 active clusters, all 45 terminated interactive clusters, and
391- * the 30 most recently terminated job clusters.
386+ * past 7 days.
387+ *
388+ * For example, if there is 1 pinned cluster, 4 active clusters, 45
389+ * terminated interactive clusters in the past 7 days, and 50 terminated job
390+ * clusters\nin the past 7 days, then this API returns the 1 pinned cluster,
391+ * 4 active clusters, all 45 terminated interactive clusters, and the 30 most
392+ * recently terminated job clusters.
392393 */
393394 async list (
394395 request : model . ListRequest ,
@@ -404,6 +405,8 @@ export class ClustersService {
404405 }
405406
406407 /**
408+ * List node types
409+ *
407410 * Returns a list of supported Spark node types. These node types can be used
408411 * to launch a cluster.
409412 */
@@ -420,8 +423,10 @@ export class ClustersService {
420423 }
421424
422425 /**
423- * Returns a list of availability zones where clusters can be created in (ex:
424- * us-west-2a). These zones can be used to launch a cluster.
426+ * List availability zones
427+ *
428+ * Returns a list of availability zones where clusters can be created in (For
429+ * example, us-west-2a). These zones can be used to launch a cluster.
425430 */
426431 async listZones (
427432 cancellationToken ?: CancellationToken
@@ -436,11 +441,14 @@ export class ClustersService {
436441 }
437442
438443 /**
444+ * Permanently delete cluster
445+ *
439446 * Permanently deletes a Spark cluster. This cluster is terminated and
440- * resources are asynchronously removed. In addition, users will no longer
441- * see permanently deleted clusters in the cluster list, and API users can no
442- * longer perform any action on permanently deleted clusters. An example
443- * request: .. code:: { "cluster_id": "1202-211320-brick1" }
447+ * resources are asynchronously removed.
448+ *
449+ * In addition, users will no longer see permanently deleted clusters in the
450+ * cluster list, and API users can no longer perform any action on
451+ * permanently deleted clusters.
444452 */
445453 async permanentDelete (
446454 request : model . PermanentDeleteCluster ,
@@ -456,10 +464,11 @@ export class ClustersService {
456464 }
457465
458466 /**
467+ * Pin cluster
468+ *
459469 * Pinning a cluster ensures that the cluster will always be returned by the
460470 * ListClusters API. Pinning a cluster that is already pinned will have no
461- * effect. This API can only be called by workspace admins. An example
462- * request: ``/clusters/pin?cluster_id=1202-211320-brick1``
471+ * effect. This API can only be called by workspace admins.
463472 */
464473 async pin (
465474 request : model . PinCluster ,
@@ -475,9 +484,10 @@ export class ClustersService {
475484 }
476485
477486 /**
487+ * Resize cluster
488+ *
478489 * Resizes a cluster to have a desired number of workers. This will fail
479- * unless the cluster is in a ``RUNNING`` state. An example request: ..
480- * code:: { "cluster_id": "1202-211320-brick1", "num_workers": 30 }
490+ * unless the cluster is in a `RUNNING` state.
481491 */
482492 async resize (
483493 request : model . ResizeCluster ,
@@ -546,9 +556,10 @@ export class ClustersService {
546556 }
547557
548558 /**
549- * Restarts a Spark cluster given its id. If the cluster is not currently in
550- * a ``RUNNING`` state, nothing will happen. An example request: .. code:: {
551- * "cluster_id": "1202-211320-brick1" }
559+ * Restart cluster
560+ *
561+ * Restarts a Spark cluster with the supplied ID. If the cluster is not
562+ * currently in a `RUNNING` state, nothing will happen.
552563 */
553564 async restart (
554565 request : model . RestartCluster ,
@@ -617,6 +628,8 @@ export class ClustersService {
617628 }
618629
619630 /**
631+ * List available Spark versions
632+ *
620633 * Returns the list of available Spark versions. These versions can be used
621634 * to launch a cluster.
622635 */
@@ -633,14 +646,16 @@ export class ClustersService {
633646 }
634647
635648 /**
636- * Starts a terminated Spark cluster given its id. This works similar to
637- * `createCluster` except: - The previous cluster id and attributes are
638- * preserved. - The cluster starts with the last specified cluster size. - If
639- * the previous cluster was an autoscaling cluster, the current cluster
640- * starts with the minimum number of nodes. - If the cluster is not currently
641- * in a ``TERMINATED`` state, nothing will happen. - Clusters launched to run
642- * a job cannot be started. An example request: .. code:: { "cluster_id":
643- * "1202-211320-brick1" }
649+ * Start terminated cluster
650+ *
651+ * Starts a terminated Spark cluster with the supplied ID. This works similar
652+ * to `createCluster` except:
653+ *
654+ * * The previous cluster id and attributes are preserved. * The cluster
655+ * starts with the last specified cluster size. * If the previous cluster was
656+ * an autoscaling cluster, the current cluster starts with the minimum number
657+ * of nodes. * If the cluster is not currently in a ``TERMINATED`` state,
658+ * nothing will happen. * Clusters launched to run a job cannot be started.
644659 */
645660 async start (
646661 request : model . StartCluster ,
@@ -709,10 +724,11 @@ export class ClustersService {
709724 }
710725
711726 /**
727+ * Unpin cluster
728+ *
712729 * Unpinning a cluster will allow the cluster to eventually be removed from
713730 * the ListClusters API. Unpinning a cluster that is not pinned will have no
714- * effect. This API can only be called by workspace admins. An example
715- * request: ``/clusters/unpin?cluster_id=1202-211320-brick1``
731+ * effect. This API can only be called by workspace admins.
716732 */
717733 async unpin (
718734 request : model . UnpinCluster ,
0 commit comments