use of com.dyngr.exception.UserBreakException in project cloudbreak by hortonworks.
the class SdxCmDiagnosticsCollectionHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<SdxCmDiagnosticsWaitRequest> event) {
SdxCmDiagnosticsWaitRequest request = event.getData();
Long sdxId = request.getResourceId();
String userId = request.getUserId();
Map<String, Object> properties = request.getProperties();
Selectable response;
try {
PollingConfig pollingConfig = new PollingConfig(sleepTimeInSec, TimeUnit.SECONDS, durationInMinutes, TimeUnit.MINUTES);
diagnosticsFlowService.waitForDiagnosticsCollection(sdxId, pollingConfig, request.getFlowIdentifier(), true);
response = new SdxDiagnosticsSuccessEvent(sdxId, userId, properties);
LOGGER.debug("SDX CM based diagnostics collection event finished");
} catch (UserBreakException userBreakException) {
LOGGER.error("Polling exited before timeout for SDX (CM based diagnostic collection): {}. Cause: ", sdxId, userBreakException);
response = new SdxCmDiagnosticsFailedEvent(sdxId, userId, properties, userBreakException);
} catch (PollerStoppedException pollerStoppedException) {
LOGGER.error("Poller stopped for SDX (CM based diagnostic collection): {}", sdxId, pollerStoppedException);
response = new SdxCmDiagnosticsFailedEvent(sdxId, userId, properties, new PollerStoppedException("Datalake CM based diagnostic collection timed out after " + durationInMinutes + " minutes"));
} catch (PollerException exception) {
LOGGER.error("Polling failed for stack (CM based diagnostic collection): {}", sdxId, exception);
response = new SdxCmDiagnosticsFailedEvent(sdxId, userId, properties, exception);
} catch (Exception anotherException) {
LOGGER.error("Something wrong happened in CM based diagnostic collection wait phase", anotherException);
response = new SdxCmDiagnosticsFailedEvent(sdxId, userId, properties, anotherException);
}
return response;
}
use of com.dyngr.exception.UserBreakException in project cloudbreak by hortonworks.
the class EnvWaitHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<EnvWaitRequest> event) {
EnvWaitRequest envWaitRequest = event.getData();
Long datalakeId = envWaitRequest.getResourceId();
String userId = envWaitRequest.getUserId();
Selectable response;
try {
LOGGER.debug("start polling env for sdx: {}", datalakeId);
DetailedEnvironmentResponse detailedEnvironmentResponse = environmentService.waitAndGetEnvironment(datalakeId);
response = new EnvWaitSuccessEvent(datalakeId, userId, detailedEnvironmentResponse);
setEnvCreatedStatus(datalakeId);
} catch (UserBreakException userBreakException) {
LOGGER.error("Env polling exited before timeout. Cause: ", userBreakException);
response = new SdxCreateFailedEvent(datalakeId, userId, userBreakException);
} catch (PollerStoppedException pollerStoppedException) {
LOGGER.error("Env poller stopped for sdx: {}", datalakeId, pollerStoppedException);
response = new SdxCreateFailedEvent(datalakeId, userId, new PollerStoppedException("Env wait timed out after " + durationInMinutes + " minutes"));
} catch (PollerException exception) {
LOGGER.error("Env polling failed for sdx: {}", datalakeId, exception);
response = new SdxCreateFailedEvent(datalakeId, userId, exception);
} catch (Exception anotherException) {
LOGGER.error("Something wrong happened in sdx creation wait phase", anotherException);
response = new SdxCreateFailedEvent(datalakeId, userId, anotherException);
}
return response;
}
use of com.dyngr.exception.UserBreakException 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.UserBreakException 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.UserBreakException 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;
}
Aggregations