/** * Terminate EMR cluster, overrides terminate protection if requested. */ @Override public void terminateEmrCluster(AmazonElasticMapReduceClient emrClient, String clusterId, boolean overrideTerminationProtection) { // Override terminate protection if requested. if (overrideTerminationProtection) { // Set termination protection emrClient.setTerminationProtection(new SetTerminationProtectionRequest().withJobFlowIds(clusterId).withTerminationProtected(false)); } // Terminate the job flow emrClient.terminateJobFlows(new TerminateJobFlowsRequest().withJobFlowIds(clusterId)); }
@After public void tearDownEmrClusters() throws Exception { if (!clusterIds.isEmpty()) { emr.terminateJobFlows(new TerminateJobFlowsRequest().withJobFlowIds(clusterIds)); } }