hashCode = prime * hashCode + ((getStatus() == null) ? 0 : getStatus().hashCode()); hashCode = prime * hashCode + ((getEc2InstanceAttributes() == null) ? 0 : getEc2InstanceAttributes().hashCode()); hashCode = prime * hashCode + ((getInstanceCollectionType() == null) ? 0 : getInstanceCollectionType().hashCode());
if (other.getName() != null && other.getName().equals(this.getName()) == false) return false; if (other.getStatus() == null ^ this.getStatus() == null) return false; if (other.getStatus() != null && other.getStatus().equals(this.getStatus()) == false) return false; if (other.getEc2InstanceAttributes() == null ^ this.getEc2InstanceAttributes() == null)
protocolMarshaller.marshall(cluster.getId(), ID_BINDING); protocolMarshaller.marshall(cluster.getName(), NAME_BINDING); protocolMarshaller.marshall(cluster.getStatus(), STATUS_BINDING); protocolMarshaller.marshall(cluster.getEc2InstanceAttributes(), EC2INSTANCEATTRIBUTES_BINDING); protocolMarshaller.marshall(cluster.getInstanceCollectionType(), INSTANCECOLLECTIONTYPE_BINDING);
/** * Get the status of the specified cluster. * * @param id the cluster id * @return the cluster status */ public co.cask.cdap.runtime.spi.provisioner.ClusterStatus getClusterStatus(String id) { return convertStatus(describeCluster(id).getStatus()); }
@Override public String getEmrClusterStatusById(String clusterId, AwsParamsDto awsParams) { Cluster cluster = getEmrClusterById(clusterId, awsParams); return ((cluster == null) ? null : cluster.getStatus().getState()); }
RunJobFlowResult runJobResult = emr.runJobFlow(runJobFlowRequest); System.out.printf("Run JobFlowId is: %s\n", runJobResult.getJobFlowId()); while(true) { DescribeClusterRequest desc = new DescribeClusterRequest() .withClusterId(runJobResult.getJobFlowId()); DescribeClusterResult clusterResult = emr.describeCluster(desc); Cluster cluster = clusterResult.getCluster(); String status = cluster.getStatus().getState(); System.out.printf("Status: %s\n", status); if(status.equals(ClusterState.TERMINATED.toString()) || status.equals(ClusterState.TERMINATED_WITH_ERRORS.toString())) { break; } try { TimeUnit.SECONDS.sleep(30); } catch (InterruptedException e) { e.printStackTrace(); } // maybe other handle }
@Override public String getEmrClusterStatusById(String clusterId, AwsParamsDto awsParams) { Cluster cluster = getEmrClusterById(clusterId, awsParams); return ((cluster == null) ? null : cluster.getStatus().getState()); }
/** * Get information about the specified cluster. The cluster will not be present if it could not be found. * * @param id the cluster id * @return the cluster information if it exists */ public Optional<co.cask.cdap.runtime.spi.provisioner.Cluster> getCluster(String id) { Cluster cluster = describeCluster(id); List<Node> nodes = new ArrayList<>(); nodes.add(new Node("id", Node.Type.MASTER, cluster.getMasterPublicDnsName(), System.currentTimeMillis(), Collections.emptyMap())); return Optional.of(new co.cask.cdap.runtime.spi.provisioner.Cluster( cluster.getId(), convertStatus(cluster.getStatus()), nodes, Collections.emptyMap())); }
String emrClusterState = cluster.getStatus().getState(); Assert.isTrue(isActiveEmrState(emrClusterState), String .format("The cluster with ID \"%s\" is not active. The cluster state must be in one of %s. Current state is \"%s\"", emrClusterIdTrimmed,
String emrClusterState = cluster.getStatus().getState(); Assert.isTrue(isActiveEmrState(emrClusterState), String .format("The cluster with ID \"%s\" is not active. The cluster state must be in one of %s. Current state is \"%s\"", emrClusterIdTrimmed,
private String getActualClusterState() { String clusterState = null; DescribeClusterRequest describeClusterRequest = new DescribeClusterRequest(); describeClusterRequest.setClusterId( hadoopJobFlowId ); DescribeClusterResult describeClusterResult = emrClient.describeCluster( describeClusterRequest ); if ( describeClusterResult != null ) { clusterState = describeClusterResult.getCluster().getStatus().getState(); } return clusterState; }
.run(ds -> emr.describeCluster(new DescribeClusterRequest().withClusterId(cluster.id()))); ClusterStatus clusterStatus = describeClusterResult.getCluster().getStatus(); String clusterState = clusterStatus.getState();
hashCode = prime * hashCode + ((getStatus() == null) ? 0 : getStatus().hashCode()); hashCode = prime * hashCode + ((getEc2InstanceAttributes() == null) ? 0 : getEc2InstanceAttributes().hashCode()); hashCode = prime * hashCode + ((getInstanceCollectionType() == null) ? 0 : getInstanceCollectionType().hashCode());
if (other.getName() != null && other.getName().equals(this.getName()) == false) return false; if (other.getStatus() == null ^ this.getStatus() == null) return false; if (other.getStatus() != null && other.getStatus().equals(this.getStatus()) == false) return false; if (other.getEc2InstanceAttributes() == null ^ this.getEc2InstanceAttributes() == null)
"Cluster name of specified cluster id \"" + emrClusterId + "\" must match the name specified."); emrCluster.setId(cluster.getId()); setEmrClusterStatus(emrCluster, cluster.getStatus());
"Cluster name of specified cluster id \"" + emrClusterId + "\" must match the name specified."); emrCluster.setId(cluster.getId()); setEmrClusterStatus(emrCluster, cluster.getStatus());
protocolMarshaller.marshall(cluster.getId(), ID_BINDING); protocolMarshaller.marshall(cluster.getName(), NAME_BINDING); protocolMarshaller.marshall(cluster.getStatus(), STATUS_BINDING); protocolMarshaller.marshall(cluster.getEc2InstanceAttributes(), EC2INSTANCEATTRIBUTES_BINDING); protocolMarshaller.marshall(cluster.getInstanceCollectionType(), INSTANCECOLLECTIONTYPE_BINDING);