use of com.sequenceiq.datalake.flow.datalake.recovery.event.DatalakeRecoveryWaitRequest in project cloudbreak by hortonworks.
the class DatalakeRecoveryWaitHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<DatalakeRecoveryWaitRequest> event) {
DatalakeRecoveryWaitRequest request = event.getData();
Long sdxId = request.getResourceId();
String userId = request.getUserId();
Selectable response;
try {
LOGGER.info("Start polling cluster recovery process for id: {}", sdxId);
PollingConfig pollingConfig = new PollingConfig(sleepTimeInSec, TimeUnit.SECONDS, durationInMinutes, TimeUnit.MINUTES);
recoveryService.waitCloudbreakFlow(sdxId, pollingConfig, "Stack Recovery");
response = new DatalakeRecoverySuccessEvent(sdxId, userId);
} catch (UserBreakException userBreakException) {
LOGGER.error("Recovery polling exited before timeout. Cause: ", userBreakException);
response = new DatalakeRecoveryFailedEvent(sdxId, userId, userBreakException);
} catch (PollerStoppedException pollerStoppedException) {
LOGGER.error("Recovery poller stopped for cluster: {}", sdxId);
response = new DatalakeRecoveryFailedEvent(sdxId, userId, new PollerStoppedException("Datalake recovery timed out after " + durationInMinutes + " minutes"));
} catch (PollerException exception) {
LOGGER.error("Recovery polling failed for cluster: {}", sdxId);
response = new DatalakeRecoveryFailedEvent(sdxId, userId, exception);
}
return response;
}
Aggregations