Search in sources :

Example 1 with DatahubOperationFailedException

use of com.sequenceiq.environment.exception.DatahubOperationFailedException in project cloudbreak by hortonworks.

the class DatahubDeletionService method waitDatahubClustersDeletion.

private void waitDatahubClustersDeletion(PollingConfig pollingConfig, Environment environment, Collection<StackViewV4Response> list, boolean force) {
    DistroXMultiDeleteV1Request multiDeleteRequest = new DistroXMultiDeleteV1Request();
    multiDeleteRequest.setCrns(list.stream().map(StackViewV4Response::getCrn).collect(Collectors.toSet()));
    LOGGER.debug("Calling distroXV1Endpoint.deleteMultiple with crn [{}]", multiDeleteRequest.getCrns());
    datahubService.deleteMultiple(environment.getResourceCrn(), multiDeleteRequest, force);
    LOGGER.debug("Starting poller to check all Datahub stacks for environment {} are deleted", environment.getName());
    try {
        Polling.stopAfterDelay(pollingConfig.getTimeout(), pollingConfig.getTimeoutTimeUnit()).stopIfException(pollingConfig.getStopPollingIfExceptionOccured()).waitPeriodly(pollingConfig.getSleepTime(), pollingConfig.getSleepTimeUnit()).run(() -> periodicCheckForDeletion(environment));
    } catch (PollerStoppedException e) {
        LOGGER.info("Datahub cluster deletion timed out");
        throw new DatahubOperationFailedException("Datahub cluster deletion timed out", e);
    }
}
Also used : StackViewV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackViewV4Response) DistroXMultiDeleteV1Request(com.sequenceiq.distrox.api.v1.distrox.model.cluster.DistroXMultiDeleteV1Request) DatahubOperationFailedException(com.sequenceiq.environment.exception.DatahubOperationFailedException) PollerStoppedException(com.dyngr.exception.PollerStoppedException)

Aggregations

PollerStoppedException (com.dyngr.exception.PollerStoppedException)1 StackViewV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackViewV4Response)1 DistroXMultiDeleteV1Request (com.sequenceiq.distrox.api.v1.distrox.model.cluster.DistroXMultiDeleteV1Request)1 DatahubOperationFailedException (com.sequenceiq.environment.exception.DatahubOperationFailedException)1