use of com.sequenceiq.datalake.flow.upgrade.ccm.event.UpgradeCcmStackRequest in project cloudbreak by hortonworks.
the class UpgradeCcmStackHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<UpgradeCcmStackRequest> event) {
UpgradeCcmStackRequest request = event.getData();
SdxCluster sdxCluster = sdxService.getById(request.getResourceId());
Long sdxId = request.getResourceId();
String userId = request.getUserId();
Selectable response;
try {
LOGGER.debug("Initiating CCM upgrade and start polling for SDX: {}", sdxCluster.getName());
PollingConfig pollingConfig = new PollingConfig(sleepTimeInSec, TimeUnit.SECONDS, durationInMinutes, TimeUnit.MINUTES);
ccmUpgradeService.initAndWaitForStackUpgrade(sdxCluster, pollingConfig);
response = new UpgradeCcmSuccessEvent(sdxId, userId);
} catch (UserBreakException userBreakException) {
LOGGER.error("Upgrade CCM poller exited before timeout. Cause: ", userBreakException);
response = new UpgradeCcmFailedEvent(sdxId, userId, userBreakException);
} catch (PollerStoppedException pollerStoppedException) {
LOGGER.error("Upgrade CCM poller stopped for stack: {}", sdxId);
response = new UpgradeCcmFailedEvent(sdxId, userId, new PollerStoppedException("Upgrade CCM timed out after " + durationInMinutes + " minutes"));
} catch (PollerException exception) {
LOGGER.error("Upgrade CCM polling failed for stack: {}", sdxId);
response = new UpgradeCcmFailedEvent(sdxId, userId, exception);
}
return response;
}
Aggregations