use of com.dyngr.exception.PollerStoppedException 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.PollerStoppedException 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.PollerStoppedException 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;
}
use of com.dyngr.exception.PollerStoppedException in project cloudbreak by hortonworks.
the class SdxDiagnosticsCollectionHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<SdxDiagnosticsWaitRequest> event) {
SdxDiagnosticsWaitRequest 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());
response = new SdxDiagnosticsSuccessEvent(sdxId, userId, properties);
LOGGER.debug("SDX diagnostics collection event finished");
} catch (UserBreakException userBreakException) {
LOGGER.error("Polling exited before timeout for SDX (diagnostic collection): {}. Cause: ", sdxId, userBreakException);
response = new SdxDiagnosticsFailedEvent(sdxId, userId, properties, userBreakException);
} catch (PollerStoppedException pollerStoppedException) {
LOGGER.error("Poller stopped for SDX (diagnostic collection): {}", sdxId, pollerStoppedException);
response = new SdxDiagnosticsFailedEvent(sdxId, userId, properties, new PollerStoppedException("Datalake diagnostic collection timed out after " + durationInMinutes + " minutes"));
} catch (PollerException exception) {
LOGGER.error("Polling failed for stack (diagnostic collection): {}", sdxId, exception);
response = new SdxDiagnosticsFailedEvent(sdxId, userId, properties, exception);
} catch (Exception anotherException) {
LOGGER.error("Something wrong happened in diagnostic collection wait phase", anotherException);
response = new SdxDiagnosticsFailedEvent(sdxId, userId, properties, anotherException);
}
return response;
}
use of com.dyngr.exception.PollerStoppedException in project cloudbreak by hortonworks.
the class DatalakeChangeImageWaitHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<DatalakeChangeImageWaitRequest> event) {
DatalakeChangeImageWaitRequest request = event.getData();
Long sdxId = request.getResourceId();
String userId = request.getUserId();
Selectable response;
try {
LOGGER.info("Start polling change image process for id: {}", sdxId);
PollingConfig pollingConfig = new PollingConfig(sleepTimeInSec, TimeUnit.SECONDS, durationInMinutes, TimeUnit.MINUTES);
upgradeService.waitCloudbreakFlow(sdxId, pollingConfig, "Change image");
String imageId = upgradeService.getImageId(sdxId);
String expectedImageId = request.getUpgradeOption().getUpgrade().getImageId();
if (Objects.equals(imageId, expectedImageId)) {
LOGGER.info("Image changed in cloudbreak side for SDX {}, actual image: {}", sdxId, imageId);
response = new DatalakeVmReplaceEvent(sdxId, userId);
} else {
String message = String.format("Image not changed in cloudbreak side, expected image: %s, actual image: %s", expectedImageId, imageId);
LOGGER.info(message);
response = new DatalakeUpgradeFailedEvent(sdxId, userId, new IllegalStateException(message));
}
} catch (UserBreakException userBreakException) {
LOGGER.error("Change image polling exited before timeout. Cause: ", userBreakException);
response = new DatalakeUpgradeFailedEvent(sdxId, userId, userBreakException);
} catch (PollerStoppedException pollerStoppedException) {
LOGGER.error("Change image poller stopped for cluster: {}", sdxId);
response = new DatalakeUpgradeFailedEvent(sdxId, userId, new PollerStoppedException("Change image poller timed out after " + durationInMinutes + " minutes"));
} catch (PollerException exception) {
LOGGER.error("Change image polling failed for cluster: {}", sdxId);
response = new DatalakeUpgradeFailedEvent(sdxId, userId, exception);
}
return response;
}
Aggregations