List of usage examples for com.amazonaws.services.elasticmapreduce.model ListClustersRequest getMarker
public String getMarker()
The pagination token that indicates the next set of results to retrieve.
From source file:org.finra.dm.dao.impl.EmrDaoImpl.java
License:Apache License
/** * Get an Active EMR cluster by the cluster name. Cluster only in following states are returned: ClusterState.BOOTSTRAPPING, ClusterState.RUNNING, * ClusterState.STARTING, ClusterState.WAITING * * @param awsParams AWS related parameters for access/secret keys and proxy details. * @param clusterName the cluster name value. * * @return the ClusterSummary object.//from w ww. j a v a 2s . c om */ @Override public ClusterSummary getActiveEmrClusterByName(String clusterName, AwsParamsDto awsParams) { if (StringUtils.isNotBlank(clusterName)) { /** * Call AWSOperations for ListClusters API. Need to list all the active clusters that are in * BOOTSTRAPPING/RUNNING/STARTING/WAITING states */ ListClustersRequest listClustersRequest = new ListClustersRequest() .withClusterStates(getActiveEmrClusterStates()); /** * ListClusterRequest returns only 50 clusters at a time. However, this returns a marker * that can be used for subsequent calls to listClusters to get all the clusters */ String markerForListClusters = listClustersRequest.getMarker(); // Loop through all the available clusters and look for the given cluster id do { /** * Call AWSOperations for ListClusters API. * Need to include the Marker returned by the previous iteration */ ListClustersResult clusterResult = emrOperations.listEmrClusters(getEmrClient(awsParams), listClustersRequest.withMarker(markerForListClusters)); // Loop through all the active clusters returned by AWS for (ClusterSummary clusterInstance : clusterResult.getClusters()) { // If the cluster name matches, then return the status if (StringUtils.isNotBlank(clusterInstance.getName()) && clusterInstance.getName().equalsIgnoreCase(clusterName)) { return clusterInstance; } } markerForListClusters = clusterResult.getMarker(); } while (markerForListClusters != null); } return null; }
From source file:org.finra.dm.dao.impl.MockEmrOperationsImpl.java
License:Apache License
@Override public ListClustersResult listEmrClusters(AmazonElasticMapReduceClient emrClient, ListClustersRequest listClustersRequest) { List<ClusterSummary> clusterSummaryList = new ArrayList<>(); for (MockEmrJobFlow cluster : emrClusters.values()) { if (!listClustersRequest.getClusterStates().isEmpty() && listClustersRequest.getClusterStates().contains(cluster.getStatus())) { ClusterSummary clusterSummary = new ClusterSummary(); clusterSummary.withId(cluster.getJobFlowId()).withName(cluster.getJobFlowName()) .withStatus(new ClusterStatus().withState(cluster.getStatus())); clusterSummaryList.add(clusterSummary); }/* ww w . j av a 2s . c o m*/ } if (StringUtils.isBlank(listClustersRequest.getMarker())) { return new ListClustersResult().withClusters(clusterSummaryList).withMarker(MOCK_EMR_MAKER); } else { return new ListClustersResult().withClusters(clusterSummaryList); } }
From source file:org.finra.herd.dao.impl.EmrDaoImpl.java
License:Apache License
@Override public ClusterSummary getActiveEmrClusterByName(String clusterName, AwsParamsDto awsParams) { if (StringUtils.isNotBlank(clusterName)) { /**//from ww w . j a v a2s. c om * Call AWSOperations for ListClusters API. Need to list all the active clusters that are in * BOOTSTRAPPING/RUNNING/STARTING/WAITING states */ ListClustersRequest listClustersRequest = new ListClustersRequest() .withClusterStates(getActiveEmrClusterStates()); /** * ListClusterRequest returns only 50 clusters at a time. However, this returns a marker * that can be used for subsequent calls to listClusters to get all the clusters */ String markerForListClusters = listClustersRequest.getMarker(); // Loop through all the available clusters and look for the given cluster id do { /** * Call AWSOperations for ListClusters API. * Need to include the Marker returned by the previous iteration */ ListClustersResult clusterResult = emrOperations.listEmrClusters(getEmrClient(awsParams), listClustersRequest.withMarker(markerForListClusters)); // Loop through all the active clusters returned by AWS for (ClusterSummary clusterInstance : clusterResult.getClusters()) { // If the cluster name matches, then return the status if (StringUtils.isNotBlank(clusterInstance.getName()) && clusterInstance.getName().equalsIgnoreCase(clusterName)) { return clusterInstance; } } markerForListClusters = clusterResult.getMarker(); } while (markerForListClusters != null); } return null; }
From source file:org.finra.herd.dao.impl.MockEmrOperationsImpl.java
License:Apache License
@Override public ListClustersResult listEmrClusters(AmazonElasticMapReduceClient emrClient, ListClustersRequest listClustersRequest) { List<ClusterSummary> clusterSummaryList = new ArrayList<>(); for (MockEmrJobFlow cluster : emrClusters.values()) { if (!listClustersRequest.getClusterStates().isEmpty() && listClustersRequest.getClusterStates().contains(cluster.getStatus())) { ClusterSummary clusterSummary = new ClusterSummary(); clusterSummary.withId(cluster.getJobFlowId()).withName(cluster.getJobFlowName()) .withStatus(new ClusterStatus().withState(cluster.getStatus()) .withStateChangeReason(new ClusterStateChangeReason() .withCode(cluster.getStatusChangeReason().getCode()) .withMessage(cluster.getStatusChangeReason().getMessage())) .withTimeline(new ClusterTimeline() .withCreationDateTime(cluster.getStatusTimeline().getCreationTime() != null ? cluster.getStatusTimeline().getCreationTime() .toGregorianCalendar().getTime() : null) .withEndDateTime(cluster.getStatusTimeline().getEndTime() != null ? cluster .getStatusTimeline().getEndTime().toGregorianCalendar().getTime() : null) .withReadyDateTime(cluster.getStatusTimeline().getReadyTime() != null ? cluster.getStatusTimeline().getReadyTime().toGregorianCalendar() .getTime() : null))); clusterSummaryList.add(clusterSummary); }/*from w w w .j av a 2 s.c om*/ } if (StringUtils.isBlank(listClustersRequest.getMarker())) { return new ListClustersResult().withClusters(clusterSummaryList).withMarker(MOCK_EMR_MAKER); } else { return new ListClustersResult().withClusters(clusterSummaryList); } }