public final class ClusterServiceImpl extends DatabricksService implements ClusterService
client, mapper| Constructor and Description |
|---|
ClusterServiceImpl(DatabricksRestClient client) |
| Modifier and Type | Method and Description |
|---|---|
String |
create(CreateClusterRequest createClusterRequest)
Deprecated.
|
String |
create(NewClusterDTO clusterDTO)
Creates a databricks cluster.
|
void |
delete(String clusterId)
Terminates a cluster.
|
void |
edit(EditClusterRequest editClusterRequest)
Deprecated.
|
void |
edit(UpsertClusterDTO clusterDTO)
Edits the configurations of a databricks cluster.
|
List<ClusterInfoDTO> |
findByName(String clusterName)
Look for clusters with a given name.
|
Optional<ClusterInfoDTO> |
findUniqueByName(String clusterName)
Same as findByName, but it will throw an exception if more then one cluster has the name.
|
ClusterInfoDTO |
getInfo(String clusterId)
Gets information about a given cluster.
|
boolean |
isClusterRunning(String clusterId)
Returns true if the cluster is running.
|
ClusterInfoDTO[] |
list()
Lists all of the clusters on a given databricks instance.
|
List<ClusterEventDTO> |
listEvents(String clusterId,
ClusterEventTypeDTO[] eventsToFilter,
int offset,
int limit)
Lists events of a specific cluster on a given databricks instance.
|
List<NodeTypeDTO> |
listNodeTypes()
Return a list of supported Spark node types.
|
List<SparkVersionDTO> |
listSparkVersions()
Return the list of available runtime versions.
|
List<String> |
listZones()
Return a list of availability zones where clusters can be created in.
|
void |
permanentDelete(String clusterId)
Permanently terminates a cluster.
|
void |
pin(String clusterId)
Pin a cluster with a given id.
|
void |
resize(AutoScaleDTO autoscale,
String clusterId)
Resizes a cluster.
|
void |
resize(int numWorkers,
String clusterId)
Resizes a cluster.
|
void |
restart(String clusterId)
Restarts a given databricks cluster.
|
void |
start(String clusterId)
Starts a databricks cluster.
|
void |
unpin(String clusterId)
Unpin a cluster with a given id.
|
void |
upsertCluster(NewClusterDTO clusterDTO)
Given a cluster settings DTO object it will:
- create the cluster if it doesn't exist
- edit the cluster if it does exist.
|
public ClusterServiceImpl(DatabricksRestClient client)
@Deprecated public String create(CreateClusterRequest createClusterRequest) throws IOException, DatabricksRestException
ClusterServicecreate in interface ClusterServicecreateClusterRequest - the cluster request objectIOException - other connection errorsDatabricksRestException - any errors with the requestpublic String create(NewClusterDTO clusterDTO) throws IOException, DatabricksRestException
ClusterServicecreate in interface ClusterServiceclusterDTO - cluster DTOIOException - other connection errorsDatabricksRestException - any errors with the request@Deprecated public void edit(EditClusterRequest editClusterRequest) throws IOException, DatabricksRestException
ClusterServiceedit in interface ClusterServiceeditClusterRequest - the edit cluster request objectIOException - any other errorsDatabricksRestException - any errors with the requestpublic void edit(UpsertClusterDTO clusterDTO) throws IOException, DatabricksRestException
ClusterServiceedit in interface ClusterServiceclusterDTO - cluster DTOIOException - any other errorsDatabricksRestException - any errors with the requestpublic void start(String clusterId) throws IOException, DatabricksRestException
ClusterServicestart in interface ClusterServiceclusterId - the clusterId of the cluster you want to start.IOException - any other errorsDatabricksRestException - any errors with the requestpublic boolean isClusterRunning(String clusterId) throws IOException, DatabricksRestException
ClusterServiceisClusterRunning in interface ClusterServiceclusterId - the clusterId to check.IOException - any other errorsDatabricksRestException - any errors with the requestpublic void restart(String clusterId) throws IOException, DatabricksRestException
ClusterServicerestart in interface ClusterServiceclusterId - the clusterid of the cluster you want to restart.IOException - any other errorsDatabricksRestException - any errors with the requestpublic void resize(int numWorkers,
String clusterId)
throws IOException,
DatabricksRestException
ClusterServiceresize in interface ClusterServicenumWorkers - the number of workers you want to resize toclusterId - the clusterId you want to operate onIOException - any other errorsDatabricksRestException - any errors with requestpublic void resize(AutoScaleDTO autoscale, String clusterId) throws IOException, DatabricksRestException
ClusterServiceresize in interface ClusterServiceautoscale - the autoscale specs.clusterId - the clusterId you want to work onIOException - any other errorsDatabricksRestException - any errors with requestpublic void delete(String clusterId) throws IOException, DatabricksRestException
ClusterServicedelete in interface ClusterServiceclusterId - the cluster you want to terminateIOException - any other errorsDatabricksRestException - errors with requestpublic void permanentDelete(String clusterId) throws IOException, DatabricksRestException
ClusterServicepermanentDelete in interface ClusterServiceclusterId - the cluster you want to permanently terminateIOException - any other errorsDatabricksRestException - errors with requestpublic ClusterInfoDTO getInfo(String clusterId) throws IOException, DatabricksRestException
ClusterServicegetInfo in interface ClusterServiceclusterId - the cluster you want to get info aboutIOException - any other errors.DatabricksRestException - any errors with the requestpublic ClusterInfoDTO[] list() throws IOException, DatabricksRestException
ClusterServicelist in interface ClusterServiceIOException - any other errorsDatabricksRestException - any errors with the requestpublic List<ClusterEventDTO> listEvents(String clusterId, ClusterEventTypeDTO[] eventsToFilter, int offset, int limit) throws IOException, DatabricksRestException
ClusterServicelistEvents in interface ClusterServiceIOException - any other errorsDatabricksRestException - any errors with the requestpublic void upsertCluster(NewClusterDTO clusterDTO) throws IOException, DatabricksRestException
ClusterServiceupsertCluster in interface ClusterServiceclusterDTO - cluster DTOIOExceptionDatabricksRestExceptionpublic List<ClusterInfoDTO> findByName(String clusterName) throws IOException, DatabricksRestException
ClusterServicefindByName in interface ClusterServiceclusterName - name to look forIOException - any other errorsDatabricksRestException - any errors with the requestpublic Optional<ClusterInfoDTO> findUniqueByName(String clusterName) throws IOException, DatabricksRestException
ClusterServicefindUniqueByName in interface ClusterServiceclusterName - name to look forIOException - any other errorsDatabricksRestException - any errors with the request,
including if more then 1 cluster was found with the name.public void pin(String clusterId) throws IOException, DatabricksRestException
ClusterServicepin in interface ClusterServiceclusterId - the clusterId you want to pinIOException - any other errorsDatabricksRestException - any errors with the requestpublic void unpin(String clusterId) throws IOException, DatabricksRestException
ClusterServiceunpin in interface ClusterServiceclusterId - the clusterId you want to unpinIOException - any other errorsDatabricksRestException - any errors with the requestpublic List<NodeTypeDTO> listNodeTypes() throws IOException, DatabricksRestException
ClusterServicelistNodeTypes in interface ClusterServiceIOException - any other errorsDatabricksRestException - any errors with the requestpublic List<String> listZones() throws IOException, DatabricksRestException
ClusterServicelistZones in interface ClusterServiceIOException - any other errorsDatabricksRestException - any errors with the requestpublic List<SparkVersionDTO> listSparkVersions() throws IOException, DatabricksRestException
ClusterServicelistSparkVersions in interface ClusterServiceIOException - any other errorsDatabricksRestException - any errors with the requestCopyright © 2023. All rights reserved.