Search in sources :

Example 1 with HistoryEndpoint

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;
}
Also used : AutoscaleClusterHistoryResponse(com.sequenceiq.periscope.api.model.AutoscaleClusterHistoryResponse) HistoryEndpoint(com.sequenceiq.periscope.api.endpoint.v1.HistoryEndpoint) StackV1Endpoint(com.sequenceiq.cloudbreak.api.endpoint.v1.StackV1Endpoint) StackEndpoint(com.sequenceiq.cloudbreak.api.endpoint.common.StackEndpoint) HistoryEndpoint(com.sequenceiq.periscope.api.endpoint.v1.HistoryEndpoint) EventEndpoint(com.sequenceiq.cloudbreak.api.endpoint.v1.EventEndpoint)

Aggregations

StackEndpoint (com.sequenceiq.cloudbreak.api.endpoint.common.StackEndpoint)1 EventEndpoint (com.sequenceiq.cloudbreak.api.endpoint.v1.EventEndpoint)1 StackV1Endpoint (com.sequenceiq.cloudbreak.api.endpoint.v1.StackV1Endpoint)1 HistoryEndpoint (com.sequenceiq.periscope.api.endpoint.v1.HistoryEndpoint)1 AutoscaleClusterHistoryResponse (com.sequenceiq.periscope.api.model.AutoscaleClusterHistoryResponse)1