use of com.sequenceiq.periscope.api.model.AutoscaleClusterHistoryResponse 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;
}
use of com.sequenceiq.periscope.api.model.AutoscaleClusterHistoryResponse in project cloudbreak by hortonworks.
the class HistoryConverter method convert.
@Override
public AutoscaleClusterHistoryResponse convert(History source) {
AutoscaleClusterHistoryResponse json = new AutoscaleClusterHistoryResponse();
json.setId(source.getId());
json.setAdjustment(source.getAdjustment());
json.setAdjustmentType(source.getAdjustmentType());
json.setAlertType(source.getAlertType());
json.setCbStackId(source.getCbStackId());
json.setClusterId(source.getClusterId());
json.setHostGroup(source.getHostGroup());
json.setOriginalNodeCount(source.getOriginalNodeCount());
json.setProperties(source.getProperties());
json.setScalingStatus(source.getScalingStatus());
json.setTimestamp(source.getTimestamp());
json.setStatusReason(source.getStatusReason());
return json;
}
Aggregations