Search in sources :

Example 1 with SdxStartWaitRequest

use of com.sequenceiq.datalake.flow.start.event.SdxStartWaitRequest in project cloudbreak by hortonworks.

the class SdxStartWaitHandler method doAccept.

@Override
protected Selectable doAccept(HandlerEvent<SdxStartWaitRequest> event) {
    SdxStartWaitRequest waitRequest = event.getData();
    Long sdxId = waitRequest.getResourceId();
    String userId = waitRequest.getUserId();
    Selectable response;
    try {
        LOGGER.debug("Start polling stack start process for id: {}", sdxId);
        PollingConfig pollingConfig = new PollingConfig(sleepTimeInSec, TimeUnit.SECONDS, durationInMinutes, TimeUnit.MINUTES);
        sdxStartService.waitCloudbreakCluster(sdxId, pollingConfig);
        response = new SdxStartSuccessEvent(sdxId, userId);
    } catch (UserBreakException userBreakException) {
        LOGGER.error("Start polling exited before timeout. Cause: ", userBreakException);
        response = new SdxStartFailedEvent(sdxId, userId, userBreakException);
    } catch (PollerStoppedException pollerStoppedException) {
        LOGGER.error("Start poller stopped for stack: {}", sdxId);
        response = new SdxStartFailedEvent(sdxId, userId, new PollerStoppedException("Datalake start timed out after " + durationInMinutes + " minutes"));
    } catch (PollerException exception) {
        LOGGER.error("Start polling failed for stack: {}", sdxId);
        response = new SdxStartFailedEvent(sdxId, userId, exception);
    }
    return response;
}
Also used : UserBreakException(com.dyngr.exception.UserBreakException) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) PollerException(com.dyngr.exception.PollerException) SdxStartSuccessEvent(com.sequenceiq.datalake.flow.start.event.SdxStartSuccessEvent) PollingConfig(com.sequenceiq.datalake.service.sdx.PollingConfig) PollerStoppedException(com.dyngr.exception.PollerStoppedException) SdxStartWaitRequest(com.sequenceiq.datalake.flow.start.event.SdxStartWaitRequest) SdxStartFailedEvent(com.sequenceiq.datalake.flow.start.event.SdxStartFailedEvent)

Aggregations

PollerException (com.dyngr.exception.PollerException)1 PollerStoppedException (com.dyngr.exception.PollerStoppedException)1 UserBreakException (com.dyngr.exception.UserBreakException)1 Selectable (com.sequenceiq.cloudbreak.common.event.Selectable)1 SdxStartFailedEvent (com.sequenceiq.datalake.flow.start.event.SdxStartFailedEvent)1 SdxStartSuccessEvent (com.sequenceiq.datalake.flow.start.event.SdxStartSuccessEvent)1 SdxStartWaitRequest (com.sequenceiq.datalake.flow.start.event.SdxStartWaitRequest)1 PollingConfig (com.sequenceiq.datalake.service.sdx.PollingConfig)1