use of com.dyngr.exception.UserBreakException in project cloudbreak by hortonworks.
the class SdxCertRotationWaitHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<SdxCertRotationWaitEvent> event) {
SdxEvent sdxEvent = event.getData();
Long sdxId = sdxEvent.getResourceId();
String userId = sdxEvent.getUserId();
Selectable response;
try {
LOGGER.debug("Start polling stack cert rotation process for id: {}", sdxId);
PollingConfig pollingConfig = new PollingConfig(sleepTimeInSec, TimeUnit.SECONDS, durationInMinutes, TimeUnit.MINUTES);
certRotationService.waitForCloudbreakClusterCertRotation(sdxId, pollingConfig);
response = new SdxEvent(SdxCertRotationEvent.CERT_ROTATION_FINISHED_EVENT.event(), sdxId, userId);
} catch (UserBreakException userBreakException) {
LOGGER.error("Cert rotation polling exited before timeout. Cause: ", userBreakException);
response = new SdxCertRotationFailedEvent(sdxId, userId, userBreakException);
} catch (PollerStoppedException pollerStoppedException) {
LOGGER.error("Cert rotation poller stopped for stack: {}", sdxId);
response = new SdxCertRotationFailedEvent(sdxId, userId, new PollerStoppedException("Datalake cert rotation timed out after " + durationInMinutes + " minutes"));
} catch (PollerException exception) {
LOGGER.error("Cert rotation polling failed for stack: {}", sdxId);
response = new SdxCertRotationFailedEvent(sdxId, userId, exception);
}
return response;
}
use of com.dyngr.exception.UserBreakException in project cloudbreak by hortonworks.
the class CloudbreakPollerTest method testCancelledFlow.
@Test
public void testCancelledFlow() {
DatalakeInMemoryStateStore.put(ID, PollGroup.CANCELLED);
UserBreakException exception = assertThrows(UserBreakException.class, () -> underTest.pollStartUntilAvailable(sdxCluster, pollingConfig));
assertEquals("Start polling cancelled on 'clusterName' cluster.", exception.getMessage());
verifyNoInteractions(cloudbreakFlowService, stackV4Endpoint, sdxStatusService);
}
use of com.dyngr.exception.UserBreakException in project cloudbreak by hortonworks.
the class DatalakeDatabaseBackupWaitHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<DatalakeDatabaseBackupWaitRequest> event) {
DatalakeDatabaseBackupWaitRequest request = event.getData();
Long sdxId = request.getResourceId();
String userId = request.getUserId();
Selectable response;
try {
LOGGER.info("Start polling datalake database backup for id: {}", sdxId);
PollingConfig pollingConfig = new PollingConfig(sleepTimeInSec, TimeUnit.SECONDS, durationInMinutes, TimeUnit.MINUTES);
sdxBackupRestoreService.waitCloudbreakFlow(sdxId, pollingConfig, "Database backup");
response = new DatalakeFullBackupInProgressEvent(sdxId, userId, request.getOperationId());
} catch (UserBreakException userBreakException) {
LOGGER.info("Database backup polling exited before timeout. Cause: ", userBreakException);
sdxBackupRestoreService.updateDatabaseStatusEntry(event.getData().getOperationId(), SdxOperationStatus.FAILED, userBreakException.getLocalizedMessage());
response = new DatalakeDatabaseBackupFailedEvent(sdxId, userId, userBreakException);
} catch (PollerStoppedException pollerStoppedException) {
LOGGER.info("Database backup poller stopped for cluster: {}", sdxId);
sdxBackupRestoreService.updateDatabaseStatusEntry(event.getData().getOperationId(), SdxOperationStatus.FAILED, pollerStoppedException.getLocalizedMessage());
response = new DatalakeDatabaseBackupFailedEvent(sdxId, userId, new PollerStoppedException("Database backup timed out after " + durationInMinutes + " minutes"));
} catch (PollerException exception) {
LOGGER.info("Database backup polling failed for cluster: {}", sdxId);
sdxBackupRestoreService.updateDatabaseStatusEntry(event.getData().getOperationId(), SdxOperationStatus.FAILED, exception.getLocalizedMessage());
response = new DatalakeDatabaseBackupFailedEvent(sdxId, userId, exception);
}
return response;
}
use of com.dyngr.exception.UserBreakException 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;
}
use of com.dyngr.exception.UserBreakException in project cloudbreak by hortonworks.
the class DatahubRefreshWaitHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<DatahubRefreshWaitEvent> event) {
SdxEvent sdxEvent = event.getData();
Long sdxId = sdxEvent.getResourceId();
String userId = sdxEvent.getUserId();
Selectable response;
try {
LOGGER.debug("Start polling datahub refresh process for id: {}", sdxId);
PollingConfig pollingConfig = new PollingConfig(sleepTimeInSec, TimeUnit.SECONDS, durationInMinutes, TimeUnit.MINUTES);
sdxRefreshService.waitCloudbreakCluster(sdxId, pollingConfig);
response = new SdxEvent(DatahubRefreshFlowEvent.DATAHUB_REFRESH_FINISHED_EVENT.event(), sdxId, userId);
} catch (UserBreakException userBreakException) {
LOGGER.error("Datahub refresh polling exited before timeout. Cause: ", userBreakException);
response = new DatahubRefreshFailedEvent(sdxId, userId, userBreakException);
} catch (PollerStoppedException pollerStoppedException) {
LOGGER.error("Datahub refresh poller stopped for stack: {}", sdxId);
response = new DatahubRefreshFailedEvent(sdxId, userId, new PollerStoppedException("Datahub refresh timed out after " + durationInMinutes + " minutes"));
} catch (PollerException exception) {
LOGGER.error("Datahub refresh polling failed for stack: {}", sdxId);
response = new DatahubRefreshFailedEvent(sdxId, userId, exception);
}
return response;
}
Aggregations