use of com.sequenceiq.periscope.api.endpoint.v1.HistoryEndpoint in project cloudbreak by hortonworks.
the class CloudbreakUtil method waitForAutoScalingEvent.
public static WaitResult waitForAutoScalingEvent(AutoscaleClient autoscaleClient, Long clusterId, Long currentTime) {
WaitResult waitResult = WaitResult.SUCCESSFUL;
Boolean exitCriteria = FALSE;
int retryCount = 0;
do {
LOGGER.info("Waiting for auto scaling event is success ...");
sleep();
HistoryEndpoint historyEndpoint = autoscaleClient.historyEndpoint();
List<AutoscaleClusterHistoryResponse> autoscaleClusterHistoryResponse = historyEndpoint.getHistory(clusterId);
for (AutoscaleClusterHistoryResponse elem : autoscaleClusterHistoryResponse) {
if ((elem.getTimestamp() > currentTime) && "SUCCESS".equals(elem.getScalingStatus().toString())) {
exitCriteria = Boolean.TRUE;
}
}
retryCount++;
} while (!exitCriteria && retryCount < MAX_RETRY);
LOGGER.info("Auto scaling event happened successfully");
if (retryCount == MAX_RETRY) {
waitResult = WaitResult.TIMEOUT;
}
return waitResult;
}
Aggregations