use of com.dyngr.exception.PollerStoppedException in project cloudbreak by hortonworks.
the class StackDeletionHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<StackDeletionWaitRequest> event) {
StackDeletionWaitRequest stackDeletionWaitRequest = event.getData();
Long sdxId = stackDeletionWaitRequest.getResourceId();
String userId = stackDeletionWaitRequest.getUserId();
Selectable response;
try {
LOGGER.debug("Start polling stack deletion process for id: {}", sdxId);
PollingConfig pollingConfig = new PollingConfig(sleepTimeInSec, TimeUnit.SECONDS, durationInMinutes, TimeUnit.MINUTES);
provisionerService.waitCloudbreakClusterDeletion(sdxId, pollingConfig);
response = new StackDeletionSuccessEvent(sdxId, userId, stackDeletionWaitRequest.isForced());
} catch (UserBreakException userBreakException) {
LOGGER.error("Deletion polling exited before timeout. Cause: ", userBreakException);
response = new SdxDeletionFailedEvent(sdxId, userId, userBreakException, stackDeletionWaitRequest.isForced());
} catch (PollerStoppedException pollerStoppedException) {
LOGGER.error("Deletion poller stopped for stack: {}", sdxId);
response = new SdxDeletionFailedEvent(sdxId, userId, new PollerStoppedException("Datalake stack deletion timed out after " + durationInMinutes + " minutes"), stackDeletionWaitRequest.isForced());
} catch (PollerException exception) {
LOGGER.error("Deletion polling failed for stack: {}", sdxId);
response = new SdxDeletionFailedEvent(sdxId, userId, exception, stackDeletionWaitRequest.isForced());
}
return response;
}
use of com.dyngr.exception.PollerStoppedException in project cloudbreak by hortonworks.
the class RdsWaitHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<RdsWaitRequest> event) {
RdsWaitRequest rdsWaitRequest = event.getData();
Long sdxId = rdsWaitRequest.getResourceId();
String userId = rdsWaitRequest.getUserId();
try {
DetailedEnvironmentResponse env = environmentService.waitNetworkAndGetEnvironment(sdxId);
Optional<SdxCluster> sdxCluster = sdxClusterRepository.findById(sdxId);
if (sdxCluster.isPresent()) {
if (sdxCluster.get().hasExternalDatabase()) {
validForDatabaseCreation(sdxId, env);
LOGGER.debug("start polling database for sdx: {}", sdxId);
databaseService.create(sdxCluster.get(), env);
setRdsCreatedStatus(sdxCluster.get());
return new RdsWaitSuccessEvent(sdxId, userId);
} else {
LOGGER.debug("skipping creation of database for sdx: {}", sdxId);
return new RdsWaitSuccessEvent(sdxId, userId);
}
} else {
throw notFound("SDX cluster", sdxId).get();
}
} catch (UserBreakException userBreakException) {
LOGGER.error("Database polling exited before timeout. Cause: ", userBreakException);
return new SdxCreateFailedEvent(sdxId, userId, userBreakException);
} catch (PollerStoppedException pollerStoppedException) {
LOGGER.error("Database poller stopped for sdx: {}", sdxId, pollerStoppedException);
return new SdxCreateFailedEvent(sdxId, userId, new PollerStoppedException("Database creation timed out after " + durationInMinutes + " minutes"));
} catch (PollerException exception) {
LOGGER.error("Database polling failed for sdx: {}", sdxId, exception);
return new SdxCreateFailedEvent(sdxId, userId, exception);
} catch (Exception anotherException) {
LOGGER.error("Something wrong happened in sdx database creation wait phase", anotherException);
return new SdxCreateFailedEvent(sdxId, userId, anotherException);
}
}
use of com.dyngr.exception.PollerStoppedException in project cloudbreak by hortonworks.
the class DatalakeVmReplaceWaitHandler method doAccept.
@Override
protected Selectable doAccept(HandlerEvent<DatalakeVmReplaceWaitRequest> event) {
DatalakeVmReplaceWaitRequest request = event.getData();
Long sdxId = request.getResourceId();
String userId = request.getUserId();
Selectable response;
try {
LOGGER.info("Start polling cluster VM replacement process for id: {}", sdxId);
PollingConfig pollingConfig = new PollingConfig(sleepTimeInSec, TimeUnit.SECONDS, durationInMinutes, TimeUnit.MINUTES);
upgradeService.waitCloudbreakFlow(sdxId, pollingConfig, "VM replace");
response = new DatalakeUpgradeSuccessEvent(sdxId, userId);
} catch (UserBreakException userBreakException) {
LOGGER.error("VM replace polling exited before timeout. Cause: ", userBreakException);
response = new DatalakeUpgradeFailedEvent(sdxId, userId, userBreakException);
} catch (PollerStoppedException pollerStoppedException) {
LOGGER.error("VM replace poller stopped for cluster: {}", sdxId);
response = new DatalakeUpgradeFailedEvent(sdxId, userId, new PollerStoppedException("VM replace timed out after " + durationInMinutes + " minutes"));
} catch (PollerException exception) {
LOGGER.error("VM replace polling failed for cluster: {}", sdxId);
response = new DatalakeUpgradeFailedEvent(sdxId, userId, exception);
} catch (Exception anotherException) {
LOGGER.error("Something wrong happened during VM replacement wait phase", anotherException);
response = new DatalakeUpgradeFailedEvent(sdxId, userId, anotherException);
}
return response;
}
use of com.dyngr.exception.PollerStoppedException 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.PollerStoppedException 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;
}
Aggregations