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;
}
Aggregations