Search in sources :

Example 1 with DatalakeUpgradeValidationFailedEvent

use of com.sequenceiq.datalake.flow.datalake.upgrade.event.DatalakeUpgradeValidationFailedEvent in project cloudbreak by hortonworks.

the class DatalakeUpgradeWaitHandler method doAccept.

@Override
protected Selectable doAccept(HandlerEvent<DatalakeUpgradeWaitRequest> event) {
    DatalakeUpgradeWaitRequest request = event.getData();
    Long sdxId = request.getResourceId();
    String userId = request.getUserId();
    Selectable response;
    try {
        LOGGER.info("Start polling cluster upgrade process for id: {}", sdxId);
        PollingConfig pollingConfig = new PollingConfig(sleepTimeInSec, TimeUnit.SECONDS, durationInMinutes, TimeUnit.MINUTES);
        upgradeService.waitCloudbreakFlow(sdxId, pollingConfig, "Stack Upgrade");
        response = new DatalakeImageChangeEvent(sdxId, userId, request.getImageId());
    } catch (UserBreakException userBreakException) {
        LOGGER.error("Upgrade polling exited before timeout. Cause: ", userBreakException);
        if (userBreakException.getCause() instanceof UpgradeValidationFailedException) {
            response = new DatalakeUpgradeValidationFailedEvent(sdxId, userId);
        } else {
            response = new DatalakeUpgradeFailedEvent(sdxId, userId, userBreakException);
        }
    } catch (PollerStoppedException pollerStoppedException) {
        LOGGER.error("Upgrade poller stopped for cluster: {}", sdxId);
        response = new DatalakeUpgradeFailedEvent(sdxId, userId, new PollerStoppedException("Datalake upgrade timed out after " + durationInMinutes + " minutes"));
    } catch (PollerException exception) {
        LOGGER.error("Upgrade polling failed for cluster: {}", sdxId);
        response = new DatalakeUpgradeFailedEvent(sdxId, userId, exception);
    }
    return response;
}
Also used : DatalakeUpgradeWaitRequest(com.sequenceiq.datalake.flow.datalake.upgrade.event.DatalakeUpgradeWaitRequest) UserBreakException(com.dyngr.exception.UserBreakException) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) PollerException(com.dyngr.exception.PollerException) DatalakeImageChangeEvent(com.sequenceiq.datalake.flow.datalake.upgrade.event.DatalakeImageChangeEvent) DatalakeUpgradeValidationFailedEvent(com.sequenceiq.datalake.flow.datalake.upgrade.event.DatalakeUpgradeValidationFailedEvent) DatalakeUpgradeFailedEvent(com.sequenceiq.datalake.flow.datalake.upgrade.event.DatalakeUpgradeFailedEvent) PollingConfig(com.sequenceiq.datalake.service.sdx.PollingConfig) PollerStoppedException(com.dyngr.exception.PollerStoppedException) UpgradeValidationFailedException(com.sequenceiq.cloudbreak.common.exception.UpgradeValidationFailedException)

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 UpgradeValidationFailedException (com.sequenceiq.cloudbreak.common.exception.UpgradeValidationFailedException)1 DatalakeImageChangeEvent (com.sequenceiq.datalake.flow.datalake.upgrade.event.DatalakeImageChangeEvent)1 DatalakeUpgradeFailedEvent (com.sequenceiq.datalake.flow.datalake.upgrade.event.DatalakeUpgradeFailedEvent)1 DatalakeUpgradeValidationFailedEvent (com.sequenceiq.datalake.flow.datalake.upgrade.event.DatalakeUpgradeValidationFailedEvent)1 DatalakeUpgradeWaitRequest (com.sequenceiq.datalake.flow.datalake.upgrade.event.DatalakeUpgradeWaitRequest)1 PollingConfig (com.sequenceiq.datalake.service.sdx.PollingConfig)1