Search in sources :

Example 6 with PollerException

use of com.dyngr.exception.PollerException 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;
}
Also used : UserBreakException(com.dyngr.exception.UserBreakException) PollerException(com.dyngr.exception.PollerException) PollingConfig(com.sequenceiq.datalake.service.sdx.PollingConfig) UserBreakException(com.dyngr.exception.UserBreakException) PollerException(com.dyngr.exception.PollerException) PollerStoppedException(com.dyngr.exception.PollerStoppedException) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) SdxDiagnosticsSuccessEvent(com.sequenceiq.datalake.flow.diagnostics.event.SdxDiagnosticsSuccessEvent) SdxCmDiagnosticsWaitRequest(com.sequenceiq.datalake.flow.diagnostics.event.SdxCmDiagnosticsWaitRequest) PollerStoppedException(com.dyngr.exception.PollerStoppedException) SdxCmDiagnosticsFailedEvent(com.sequenceiq.datalake.flow.diagnostics.event.SdxCmDiagnosticsFailedEvent)

Example 7 with PollerException

use of com.dyngr.exception.PollerException 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;
}
Also used : UserBreakException(com.dyngr.exception.UserBreakException) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) SdxCreateFailedEvent(com.sequenceiq.datalake.flow.create.event.SdxCreateFailedEvent) PollerException(com.dyngr.exception.PollerException) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) EnvWaitRequest(com.sequenceiq.datalake.flow.create.event.EnvWaitRequest) EnvWaitSuccessEvent(com.sequenceiq.datalake.flow.create.event.EnvWaitSuccessEvent) PollerStoppedException(com.dyngr.exception.PollerStoppedException) UserBreakException(com.dyngr.exception.UserBreakException) PollerException(com.dyngr.exception.PollerException) PollerStoppedException(com.dyngr.exception.PollerStoppedException)

Example 8 with PollerException

use of com.dyngr.exception.PollerException 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;
}
Also used : DatalakeFullRestoreInProgressEvent(com.sequenceiq.datalake.flow.dr.restore.event.DatalakeFullRestoreInProgressEvent) UserBreakException(com.dyngr.exception.UserBreakException) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) DatalakeDatabaseRestoreFailedEvent(com.sequenceiq.datalake.flow.dr.restore.event.DatalakeDatabaseRestoreFailedEvent) PollerException(com.dyngr.exception.PollerException) DatalakeDatabaseRestoreWaitRequest(com.sequenceiq.datalake.flow.dr.restore.event.DatalakeDatabaseRestoreWaitRequest) PollingConfig(com.sequenceiq.datalake.service.sdx.PollingConfig) PollerStoppedException(com.dyngr.exception.PollerStoppedException)

Example 9 with PollerException

use of com.dyngr.exception.PollerException 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;
}
Also used : DatalakeRestoreSuccessEvent(com.sequenceiq.datalake.flow.dr.restore.event.DatalakeRestoreSuccessEvent) UserBreakException(com.dyngr.exception.UserBreakException) DatalakeRestoreFailedEvent(com.sequenceiq.datalake.flow.dr.restore.event.DatalakeRestoreFailedEvent) DatalakeFullRestoreWaitRequest(com.sequenceiq.datalake.flow.dr.restore.event.DatalakeFullRestoreWaitRequest) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) PollerException(com.dyngr.exception.PollerException) PollingConfig(com.sequenceiq.datalake.service.sdx.PollingConfig) CloudbreakApiException(com.sequenceiq.cloudbreak.exception.CloudbreakApiException) PollerStoppedException(com.dyngr.exception.PollerStoppedException)

Example 10 with PollerException

use of com.dyngr.exception.PollerException 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;
}
Also used : DatalakeBackupFailedEvent(com.sequenceiq.datalake.flow.dr.backup.event.DatalakeBackupFailedEvent) DatalakeFullBackupWaitRequest(com.sequenceiq.datalake.flow.dr.backup.event.DatalakeFullBackupWaitRequest) UserBreakException(com.dyngr.exception.UserBreakException) Selectable(com.sequenceiq.cloudbreak.common.event.Selectable) PollerException(com.dyngr.exception.PollerException) DatalakeBackupSuccessEvent(com.sequenceiq.datalake.flow.dr.backup.event.DatalakeBackupSuccessEvent) PollingConfig(com.sequenceiq.datalake.service.sdx.PollingConfig) CloudbreakApiException(com.sequenceiq.cloudbreak.exception.CloudbreakApiException) PollerStoppedException(com.dyngr.exception.PollerStoppedException)

Aggregations

PollerException (com.dyngr.exception.PollerException)37 PollerStoppedException (com.dyngr.exception.PollerStoppedException)31 UserBreakException (com.dyngr.exception.UserBreakException)30 Selectable (com.sequenceiq.cloudbreak.common.event.Selectable)28 PollingConfig (com.sequenceiq.datalake.service.sdx.PollingConfig)22 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)7 SdxCluster (com.sequenceiq.datalake.entity.SdxCluster)5 SdxCreateFailedEvent (com.sequenceiq.datalake.flow.create.event.SdxCreateFailedEvent)5 DatabaseAvailabilityType (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.database.DatabaseAvailabilityType)4 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)4 SdxEvent (com.sequenceiq.datalake.flow.SdxEvent)4 SdxStopFailedEvent (com.sequenceiq.datalake.flow.stop.event.SdxStopFailedEvent)4 Test (org.junit.jupiter.api.Test)4 DatalakeUpgradeFailedEvent (com.sequenceiq.datalake.flow.datalake.upgrade.event.DatalakeUpgradeFailedEvent)3 SdxDiagnosticsSuccessEvent (com.sequenceiq.datalake.flow.diagnostics.event.SdxDiagnosticsSuccessEvent)3 CloudbreakApiException (com.sequenceiq.cloudbreak.exception.CloudbreakApiException)2 StackCreationSuccessEvent (com.sequenceiq.datalake.flow.create.event.StackCreationSuccessEvent)2 StackCreationWaitRequest (com.sequenceiq.datalake.flow.create.event.StackCreationWaitRequest)2 SdxDeletionFailedEvent (com.sequenceiq.datalake.flow.delete.event.SdxDeletionFailedEvent)2 SdxDiagnosticsFailedEvent (com.sequenceiq.datalake.flow.diagnostics.event.SdxDiagnosticsFailedEvent)2