Search in sources :

Example 1 with TransactionRuntimeExecutionException

use of com.sequenceiq.cloudbreak.common.service.TransactionService.TransactionRuntimeExecutionException in project cloudbreak by hortonworks.

the class PillarConfigUpdateService method configUpdateFinished.

public void configUpdateFinished(StackView stackView) {
    try {
        transactionService.required(() -> {
            stackUpdater.updateStackStatus(stackView.getId(), DetailedStackStatus.AVAILABLE, "Config update finished.");
        });
        flowMessageService.fireEventAndLog(stackView.getId(), AVAILABLE.name(), CLUSTER_PILLAR_CONFIG_UPDATE_FINISHED);
    } catch (TransactionExecutionException e) {
        throw new TransactionRuntimeExecutionException(e);
    }
}
Also used : TransactionExecutionException(com.sequenceiq.cloudbreak.common.service.TransactionService.TransactionExecutionException) TransactionRuntimeExecutionException(com.sequenceiq.cloudbreak.common.service.TransactionService.TransactionRuntimeExecutionException)

Example 2 with TransactionRuntimeExecutionException

use of com.sequenceiq.cloudbreak.common.service.TransactionService.TransactionRuntimeExecutionException in project cloudbreak by hortonworks.

the class ClusterCreationService method clusterInstallationFinished.

public void clusterInstallationFinished(StackView stackView, ProvisionType provisionType) {
    try {
        transactionService.required(() -> {
            if (provisionType.isRecovery()) {
                stackUpdater.updateStackStatus(stackView.getId(), DetailedStackStatus.CLUSTER_RECOVERY_FINISHED, "Cluster recovery finished.");
                flowMessageService.fireEventAndLog(stackView.getId(), AVAILABLE.name(), RECOVERY_FINISHED);
            } else {
                stackUpdater.updateStackStatus(stackView.getId(), DetailedStackStatus.AVAILABLE, "Cluster creation finished.");
                flowMessageService.fireEventAndLog(stackView.getId(), AVAILABLE.name(), CLUSTER_BUILT);
            }
        });
    } catch (TransactionExecutionException e) {
        throw new TransactionRuntimeExecutionException(e);
    }
}
Also used : TransactionExecutionException(com.sequenceiq.cloudbreak.common.service.TransactionService.TransactionExecutionException) TransactionRuntimeExecutionException(com.sequenceiq.cloudbreak.common.service.TransactionService.TransactionRuntimeExecutionException)

Example 3 with TransactionRuntimeExecutionException

use of com.sequenceiq.cloudbreak.common.service.TransactionService.TransactionRuntimeExecutionException in project cloudbreak by hortonworks.

the class ClusterStartService method updateInstancesToHealthy.

private void updateInstancesToHealthy(StackView stack) {
    try {
        transactionService.required(() -> {
            Set<InstanceMetaData> instances = instanceMetaDataService.findNotTerminatedAndNotZombieForStack(stack.getId());
            for (InstanceMetaData metaData : instances) {
                metaData.setInstanceStatus(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.InstanceStatus.SERVICES_HEALTHY);
            }
            instanceMetaDataService.saveAll(instances);
        });
    } catch (TransactionExecutionException e) {
        throw new TransactionRuntimeExecutionException(e);
    }
}
Also used : InstanceMetaData(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData) TransactionExecutionException(com.sequenceiq.cloudbreak.common.service.TransactionService.TransactionExecutionException) TransactionRuntimeExecutionException(com.sequenceiq.cloudbreak.common.service.TransactionService.TransactionRuntimeExecutionException)

Example 4 with TransactionRuntimeExecutionException

use of com.sequenceiq.cloudbreak.common.service.TransactionService.TransactionRuntimeExecutionException in project cloudbreak by hortonworks.

the class SaltUpdateService method clusterInstallationFinished.

public void clusterInstallationFinished(StackView stackView) {
    try {
        transactionService.required(() -> {
            stackUpdater.updateStackStatus(stackView.getId(), DetailedStackStatus.AVAILABLE, "Salt update finished.");
            flowMessageService.fireEventAndLog(stackView.getId(), AVAILABLE.name(), CLUSTER_SALT_UPDATE_FINISHED);
        });
    } catch (TransactionExecutionException e) {
        throw new TransactionRuntimeExecutionException(e);
    }
}
Also used : TransactionExecutionException(com.sequenceiq.cloudbreak.common.service.TransactionService.TransactionExecutionException) TransactionRuntimeExecutionException(com.sequenceiq.cloudbreak.common.service.TransactionService.TransactionRuntimeExecutionException)

Example 5 with TransactionRuntimeExecutionException

use of com.sequenceiq.cloudbreak.common.service.TransactionService.TransactionRuntimeExecutionException in project cloudbreak by hortonworks.

the class ClusterCommonService method put.

public FlowIdentifier put(String crn, UpdateClusterV4Request updateJson) {
    Stack stack = stackService.getByCrnWithLists(crn);
    Long stackId = stack.getId();
    MDCBuilder.buildMdcContext(stack);
    UserNamePasswordV4Request userNamePasswordJson = updateJson.getUserNamePassword();
    FlowIdentifier flowIdentifier;
    if (userNamePasswordJson != null) {
        flowIdentifier = clusterManagerUserNamePasswordChange(stack, userNamePasswordJson);
    } else if (updateJson.getStatus() != null) {
        LOGGER.debug("Cluster status update request received. Stack id:  {}, status: {} ", stackId, updateJson.getStatus());
        flowIdentifier = clusterOperationService.updateStatus(stackId, updateJson.getStatus());
    } else if (updateJson.getBlueprintName() != null && updateJson.getHostgroups() != null && stack.getCluster().isCreateFailed()) {
        LOGGER.debug("Cluster rebuild request received. Stack id:  {}", stackId);
        try {
            flowIdentifier = recreateCluster(stack, updateJson);
        } catch (TransactionExecutionException e) {
            throw new TransactionRuntimeExecutionException(e);
        }
    } else if (updateJson.getHostGroupAdjustment() != null) {
        environmentService.checkEnvironmentStatus(stack, EnvironmentStatus.upscalable());
        flowIdentifier = clusterHostgroupAdjustmentChange(stackId, updateJson, stack);
    } else {
        LOGGER.info("Invalid cluster update request received. Stack id: {}", stackId);
        throw new BadRequestException("Invalid update cluster request!");
    }
    return flowIdentifier;
}
Also used : TransactionExecutionException(com.sequenceiq.cloudbreak.common.service.TransactionService.TransactionExecutionException) UserNamePasswordV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.UserNamePasswordV4Request) BadRequestException(com.sequenceiq.cloudbreak.common.exception.BadRequestException) FlowIdentifier(com.sequenceiq.flow.api.model.FlowIdentifier) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) TransactionRuntimeExecutionException(com.sequenceiq.cloudbreak.common.service.TransactionService.TransactionRuntimeExecutionException)

Aggregations

TransactionRuntimeExecutionException (com.sequenceiq.cloudbreak.common.service.TransactionService.TransactionRuntimeExecutionException)33 TransactionExecutionException (com.sequenceiq.cloudbreak.common.service.TransactionService.TransactionExecutionException)31 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)16 InstanceMetaData (com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData)8 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)7 StackV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response)6 CloudbreakImageNotFoundException (com.sequenceiq.cloudbreak.core.CloudbreakImageNotFoundException)6 AutoscaleStack (com.sequenceiq.cloudbreak.domain.projection.AutoscaleStack)6 FlowIdentifier (com.sequenceiq.flow.api.model.FlowIdentifier)6 AutoscaleStackV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.AutoscaleStackV4Response)5 NotFoundException (com.sequenceiq.cloudbreak.common.exception.NotFoundException)5 InstanceStatus (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.InstanceStatus)4 CloudbreakServiceException (com.sequenceiq.cloudbreak.common.exception.CloudbreakServiceException)4 Workspace (com.sequenceiq.cloudbreak.workspace.model.Workspace)4 List (java.util.List)4 Map (java.util.Map)4 Optional (java.util.Optional)4 Set (java.util.Set)4 Inject (javax.inject.Inject)4 Logger (org.slf4j.Logger)4