Java Code Examples for com.amazonaws.services.elasticmapreduce.model.DescribeClusterResult#getCluster()
The following examples show how to use
com.amazonaws.services.elasticmapreduce.model.DescribeClusterResult#getCluster() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EmrClusterTableProvider.java From aws-athena-query-federation with Apache License 2.0 | 6 votes |
/** * Calls ListClusters and DescribeCluster on the AWS EMR Client returning all clusters that match the supplied * predicate and attempting to push down certain predicates (namely queries for specific cluster) to EC2. * * @See TableProvider */ @Override public void readWithConstraint(BlockSpiller spiller, ReadRecordsRequest recordsRequest, QueryStatusChecker queryStatusChecker) { boolean done = false; ListClustersRequest request = new ListClustersRequest(); while (!done) { ListClustersResult response = emr.listClusters(request); for (ClusterSummary next : response.getClusters()) { Cluster cluster = null; if (!next.getStatus().getState().toLowerCase().contains("terminated")) { DescribeClusterResult clusterResponse = emr.describeCluster(new DescribeClusterRequest().withClusterId(next.getId())); cluster = clusterResponse.getCluster(); } clusterToRow(next, cluster, spiller); } request.setMarker(response.getMarker()); if (response.getMarker() == null || !queryStatusChecker.isQueryRunning()) { done = true; } } }
Example 2
Source File: EmrDaoImpl.java From herd with Apache License 2.0 | 6 votes |
@Override public Cluster getEmrClusterById(String clusterId, AwsParamsDto awsParams) { Cluster cluster = null; if (StringUtils.isNotBlank(clusterId)) { DescribeClusterResult describeClusterResult = emrOperations.describeClusterRequest(getEmrClient(awsParams), new DescribeClusterRequest().withClusterId(clusterId)); if (describeClusterResult != null && describeClusterResult.getCluster() != null) { cluster = describeClusterResult.getCluster(); } } return cluster; }
Example 3
Source File: EMRUtils.java From aws-big-data-blog with Apache License 2.0 | 5 votes |
/** * Helper method to determine if an Amazon EMR cluster exists * * @param client * The {@link AmazonElasticMapReduceClient} with read permissions * @param clusterIdentifier * The Amazon EMR cluster to check * @return true if the Amazon EMR cluster exists, otherwise false */ public static boolean clusterExists(AmazonElasticMapReduce client, String clusterIdentifier) { if (clusterIdentifier != null && !clusterIdentifier.isEmpty()) { ListClustersResult clustersList = client.listClusters(); ListIterator<ClusterSummary> iterator = clustersList.getClusters().listIterator(); ClusterSummary summary; for (summary = iterator.next() ; iterator.hasNext();summary = iterator.next()) { if (summary.getId().equals(clusterIdentifier)) { DescribeClusterRequest describeClusterRequest = new DescribeClusterRequest().withClusterId(clusterIdentifier); DescribeClusterResult result = client.describeCluster(describeClusterRequest); if (result != null) { Cluster cluster = result.getCluster(); //check if HBase is installed on this cluster if (isHBaseInstalled(client, cluster.getId())) return false; String state = cluster.getStatus().getState(); LOG.info(clusterIdentifier + " is " + state + ". "); if (state.equalsIgnoreCase("RUNNING") ||state.equalsIgnoreCase("WAITING")) { LOG.info("The cluster with id " + clusterIdentifier + " exists and is " + state); return true; } } } } } LOG.info("The cluster with id " + clusterIdentifier + " does not exist"); return false; }