use of com.dyngr.exception.PollerStoppedException in project cloudbreak by hortonworks.
the class DatalakeDatabaseRestoreWaitHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<DatalakeDatabaseRestoreWaitRequest> event) {
DatalakeDatabaseRestoreWaitRequest request = event.getData();
Long sdxId = request.getResourceId();
String userId = request.getUserId();
Selectable response;
try {
LOGGER.info("Start polling datalake database restore for id: {}", sdxId);
PollingConfig pollingConfig = new PollingConfig(sleepTimeInSec, TimeUnit.SECONDS, durationInMinutes, TimeUnit.MINUTES);
sdxBackupRestoreService.waitCloudbreakFlow(sdxId, pollingConfig, "Database restore");
response = new DatalakeFullRestoreInProgressEvent(sdxId, userId, request.getOperationId());
} catch (UserBreakException userBreakException) {
LOGGER.info("Database restore polling exited before timeout. Cause: ", userBreakException);
sdxBackupRestoreService.updateDatabaseStatusEntry(event.getData().getOperationId(), SdxOperationStatus.FAILED, userBreakException.getLocalizedMessage());
response = new DatalakeDatabaseRestoreFailedEvent(sdxId, userId, userBreakException);
} catch (PollerStoppedException pollerStoppedException) {
LOGGER.info("Database restore poller stopped for cluster: {}", sdxId);
sdxBackupRestoreService.updateDatabaseStatusEntry(event.getData().getOperationId(), SdxOperationStatus.FAILED, pollerStoppedException.getLocalizedMessage());
response = new DatalakeDatabaseRestoreFailedEvent(sdxId, userId, new PollerStoppedException("Database restore timed out after " + durationInMinutes + " minutes"));
} catch (PollerException exception) {
LOGGER.info("Database restore polling failed for cluster: {}", sdxId);
sdxBackupRestoreService.updateDatabaseStatusEntry(event.getData().getOperationId(), SdxOperationStatus.FAILED, exception.getLocalizedMessage());
response = new DatalakeDatabaseRestoreFailedEvent(sdxId, userId, exception);
}
return response;
}
use of com.dyngr.exception.PollerStoppedException in project cloudbreak by hortonworks.
the class DatalakeFullRestoreWaitHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<DatalakeFullRestoreWaitRequest> event) {
DatalakeFullRestoreWaitRequest request = event.getData();
Long sdxId = request.getResourceId();
String userId = request.getUserId();
Selectable response;
try {
LOGGER.info("Start polling datalake full restore status for id: {}", sdxId);
PollingConfig pollingConfig = new PollingConfig(sleepTimeInSec, TimeUnit.SECONDS, durationInMinutes, TimeUnit.MINUTES);
sdxBackupRestoreService.waitForDatalakeDrRestoreToComplete(sdxId, request.getOperationId(), request.getUserId(), pollingConfig, "Full restore");
response = new DatalakeRestoreSuccessEvent(sdxId, userId, request.getOperationId());
} catch (UserBreakException userBreakException) {
LOGGER.info("Full restore polling exited before timeout. Cause: ", userBreakException);
response = new DatalakeRestoreFailedEvent(sdxId, userId, userBreakException);
} catch (PollerStoppedException pollerStoppedException) {
LOGGER.info("Full restore poller stopped for cluster: {}", sdxId);
response = new DatalakeRestoreFailedEvent(sdxId, userId, new PollerStoppedException("Data lake restore timed out after " + durationInMinutes + " minutes"));
} catch (PollerException exception) {
LOGGER.info("Full restore polling failed for cluster: {}", sdxId);
response = new DatalakeRestoreFailedEvent(sdxId, userId, exception);
} catch (CloudbreakApiException exception) {
LOGGER.info("Datalake restore failed. Reason: " + exception.getMessage());
response = new DatalakeRestoreFailedEvent(sdxId, userId, exception);
}
return response;
}
use of com.dyngr.exception.PollerStoppedException in project cloudbreak by hortonworks.
the class DatalakeFullBackupWaitHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<DatalakeFullBackupWaitRequest> event) {
DatalakeFullBackupWaitRequest request = event.getData();
Long sdxId = request.getResourceId();
String userId = request.getUserId();
Selectable response;
try {
LOGGER.info("Start polling datalake full backup status for id: {}", sdxId);
PollingConfig pollingConfig = new PollingConfig(sleepTimeInSec, TimeUnit.SECONDS, durationInMinutes, TimeUnit.MINUTES);
sdxBackupRestoreService.waitForDatalakeDrBackupToComplete(sdxId, request.getOperationId(), request.getUserId(), pollingConfig, "Full backup");
response = new DatalakeBackupSuccessEvent(sdxId, userId, request.getOperationId());
} catch (UserBreakException userBreakException) {
LOGGER.info("Full backup polling exited before timeout. Cause: ", userBreakException);
response = new DatalakeBackupFailedEvent(sdxId, userId, userBreakException);
} catch (PollerStoppedException pollerStoppedException) {
LOGGER.info("Full backup poller stopped for cluster: {}", sdxId);
response = new DatalakeBackupFailedEvent(sdxId, userId, new PollerStoppedException("Datalake backup timed out after " + durationInMinutes + " minutes"));
} catch (PollerException exception) {
LOGGER.info("Full backup polling failed for cluster: {}", sdxId);
response = new DatalakeBackupFailedEvent(sdxId, userId, exception);
} catch (CloudbreakApiException exception) {
LOGGER.info("Datalake backup failed. Reason: " + exception.getMessage());
response = new DatalakeBackupFailedEvent(sdxId, userId, exception);
}
return response;
}
use of com.dyngr.exception.PollerStoppedException in project cloudbreak by hortonworks.
the class SdxRepairWaitHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<SdxRepairWaitRequest> event) {
SdxRepairWaitRequest sdxRepairWaitRequest = event.getData();
Long sdxId = sdxRepairWaitRequest.getResourceId();
String userId = sdxRepairWaitRequest.getUserId();
Selectable response;
try {
LOGGER.debug("Start polling stack repair process for id: {}", sdxId);
PollingConfig pollingConfig = new PollingConfig(sleepTimeInSec, TimeUnit.SECONDS, durationInMinutes, TimeUnit.MINUTES);
repairService.waitCloudbreakClusterRepair(sdxId, pollingConfig);
response = new SdxRepairSuccessEvent(sdxId, userId);
} catch (UserBreakException userBreakException) {
LOGGER.error("Repair polling exited before timeout. Cause: ", userBreakException);
response = new SdxRepairFailedEvent(sdxId, userId, userBreakException);
} catch (PollerStoppedException pollerStoppedException) {
LOGGER.error("Repair poller stopped for stack: {}", sdxId);
response = new SdxRepairFailedEvent(sdxId, userId, new PollerStoppedException("Datalake repair timed out after " + durationInMinutes + " minutes"));
} catch (PollerException exception) {
LOGGER.error("Repair polling failed for stack: {}", sdxId);
response = new SdxRepairFailedEvent(sdxId, userId, exception);
}
return response;
}
use of com.dyngr.exception.PollerStoppedException in project cloudbreak by hortonworks.
the class RdsStopHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<RdsWaitingToStopRequest> event) {
RdsWaitingToStopRequest rdsWaitRequest = event.getData();
Long sdxId = rdsWaitRequest.getResourceId();
String userId = rdsWaitRequest.getUserId();
Selectable response;
try {
sdxClusterRepository.findById(sdxId).ifPresent(sdxCluster -> {
if (databasePauseSupportService.isDatabasePauseSupported(sdxCluster)) {
sdxStatusService.setStatusForDatalakeAndNotify(DatalakeStatusEnum.EXTERNAL_DATABASE_STOP_IN_PROGRESS, "External database stop in progress", sdxCluster);
LOGGER.debug("stop polling database stop for sdx: {}", sdxId);
databaseService.stop(sdxCluster);
} else {
LOGGER.debug("skipping stop of database for sdx: {}", sdxId);
}
sdxStatusService.setStatusForDatalakeAndNotify(DatalakeStatusEnum.EXTERNAL_DATABASE_STOPPED, "External database stopped", sdxCluster);
});
response = new RdsStopSuccessEvent(sdxId, userId);
} catch (UserBreakException userBreakException) {
LOGGER.error("Database polling exited before timeout. Cause: ", userBreakException);
response = new SdxStopFailedEvent(sdxId, userId, userBreakException);
} catch (PollerStoppedException pollerStoppedException) {
LOGGER.error("Database poller stopped for sdx: {}", sdxId, pollerStoppedException);
response = new SdxStopFailedEvent(sdxId, userId, new PollerStoppedException("Database stop timed out after " + durationInMinutes + " minutes"));
} catch (PollerException exception) {
LOGGER.error("Database polling failed for sdx: {}", sdxId, exception);
response = new SdxStopFailedEvent(sdxId, userId, exception);
} catch (Exception anotherException) {
LOGGER.error("Something wrong happened in sdx database stop wait phase", anotherException);
response = new SdxStopFailedEvent(sdxId, userId, anotherException);
}
return response;
}
Aggregations