private String doClusterDestroy(RestTemplate restTemplate, YarnClient client, ApplicationId applicationId, String clusterId) { YarnContainerClusterOperations operations = buildClusterOperations(restTemplate, client, applicationId); operations.clusterDestroy(clusterId); return "Cluster " + clusterId + " destroyed."; }
public void destroyCluster(ApplicationId applicationId, String clusterId) { Collection<CloudAppInstanceInfo> submittedApplications = getSubmittedApplications(applicationId.toString()); if (submittedApplications.isEmpty()) { return; } if (submittedApplications.iterator().next().getState() != "RUNNING") { return; } YarnContainerClusterOperations operations = buildClusterOperations(restTemplate, yarnClient, applicationId); operations.clusterDestroy(clusterId); }