Search in sources :

Example 1 with UPSCALE_AMBARI_PROGRESS_STATE

use of com.sequenceiq.cloudbreak.service.cluster.ambari.AmbariOperationType.UPSCALE_AMBARI_PROGRESS_STATE in project cloudbreak by hortonworks.

the class AmbariClusterModificationService method upscaleCluster.

@Override
public void upscaleCluster(Stack stack, HostGroup hostGroup, Collection<HostMetadata> hostMetadata) throws CloudbreakException {
    AmbariClient ambariClient = clientFactory.getAmbariClient(stack, stack.getCluster());
    List<String> upscaleHostNames = hostMetadata.stream().map(HostMetadata::getHostName).collect(Collectors.toList()).stream().filter(hostName -> !ambariClient.getClusterHosts().contains(hostName)).collect(Collectors.toList());
    if (!upscaleHostNames.isEmpty()) {
        recipeEngine.executePostAmbariStartRecipes(stack, Sets.newHashSet(hostGroup));
        Pair<PollingResult, Exception> pollingResult = ambariOperationService.waitForOperations(stack, ambariClient, installServices(upscaleHostNames, stack, ambariClient, hostGroup.getName()), UPSCALE_AMBARI_PROGRESS_STATE);
        String message = pollingResult.getRight() == null ? cloudbreakMessagesService.getMessage(AMBARI_CLUSTER_UPSCALE_FAILED.code()) : pollingResult.getRight().getMessage();
        ambariClusterConnectorPollingResultChecker.checkPollingResult(pollingResult.getLeft(), message);
    }
}
Also used : CloudbreakException(com.sequenceiq.cloudbreak.service.CloudbreakException) AmbariConnectionException(com.sequenceiq.ambari.client.AmbariConnectionException) HttpResponseException(groovyx.net.http.HttpResponseException) LoggerFactory(org.slf4j.LoggerFactory) UPDATE_IN_PROGRESS(com.sequenceiq.cloudbreak.api.model.Status.UPDATE_IN_PROGRESS) UPSCALE_AMBARI_PROGRESS_STATE(com.sequenceiq.cloudbreak.service.cluster.ambari.AmbariOperationType.UPSCALE_AMBARI_PROGRESS_STATE) CloudbreakMessagesService(com.sequenceiq.cloudbreak.service.messages.CloudbreakMessagesService) Inject(javax.inject.Inject) HostMetadata(com.sequenceiq.cloudbreak.domain.HostMetadata) Pair(org.apache.commons.lang3.tuple.Pair) PollingResult.isTimeout(com.sequenceiq.cloudbreak.service.PollingResult.isTimeout) BadRequestException(com.sequenceiq.cloudbreak.controller.BadRequestException) RecipeEngine(com.sequenceiq.cloudbreak.service.cluster.flow.RecipeEngine) Service(org.springframework.stereotype.Service) Map(java.util.Map) Collections.singletonMap(java.util.Collections.singletonMap) PollingResult(com.sequenceiq.cloudbreak.service.PollingResult) ClusterModificationService(com.sequenceiq.cloudbreak.service.cluster.api.ClusterModificationService) Stack(com.sequenceiq.cloudbreak.domain.Stack) HostMetadataRepository(com.sequenceiq.cloudbreak.repository.HostMetadataRepository) AMBARI_CLUSTER_UPSCALE_FAILED(com.sequenceiq.cloudbreak.service.cluster.ambari.AmbariMessages.AMBARI_CLUSTER_UPSCALE_FAILED) HostGroup(com.sequenceiq.cloudbreak.domain.HostGroup) AMBARI_CLUSTER_SERVICES_STOPPED(com.sequenceiq.cloudbreak.service.cluster.ambari.AmbariMessages.AMBARI_CLUSTER_SERVICES_STOPPED) Logger(org.slf4j.Logger) AMBARI_CLUSTER_SERVICES_STARTING(com.sequenceiq.cloudbreak.service.cluster.ambari.AmbariMessages.AMBARI_CLUSTER_SERVICES_STARTING) Collection(java.util.Collection) Set(java.util.Set) AmbariClientExceptionUtil(com.sequenceiq.cloudbreak.util.AmbariClientExceptionUtil) Collectors(java.util.stream.Collectors) PollingResult.isExited(com.sequenceiq.cloudbreak.service.PollingResult.isExited) Sets(com.google.common.collect.Sets) AMBARI_CLUSTER_SERVICES_STOPPING(com.sequenceiq.cloudbreak.service.cluster.ambari.AmbariMessages.AMBARI_CLUSTER_SERVICES_STOPPING) List(java.util.List) AmbariOperationService(com.sequenceiq.cloudbreak.service.cluster.flow.AmbariOperationService) STOP_AMBARI_PROGRESS_STATE(com.sequenceiq.cloudbreak.service.cluster.ambari.AmbariOperationType.STOP_AMBARI_PROGRESS_STATE) CancellationException(com.sequenceiq.cloudbreak.cloud.scheduler.CancellationException) CloudbreakServiceException(com.sequenceiq.cloudbreak.service.CloudbreakServiceException) CloudbreakEventService(com.sequenceiq.cloudbreak.service.events.CloudbreakEventService) AmbariClient(com.sequenceiq.ambari.client.AmbariClient) PollingResult(com.sequenceiq.cloudbreak.service.PollingResult) CloudbreakException(com.sequenceiq.cloudbreak.service.CloudbreakException) AmbariConnectionException(com.sequenceiq.ambari.client.AmbariConnectionException) HttpResponseException(groovyx.net.http.HttpResponseException) BadRequestException(com.sequenceiq.cloudbreak.controller.BadRequestException) CancellationException(com.sequenceiq.cloudbreak.cloud.scheduler.CancellationException) CloudbreakServiceException(com.sequenceiq.cloudbreak.service.CloudbreakServiceException) AmbariClient(com.sequenceiq.ambari.client.AmbariClient) HostMetadata(com.sequenceiq.cloudbreak.domain.HostMetadata)

Aggregations

Sets (com.google.common.collect.Sets)1 AmbariClient (com.sequenceiq.ambari.client.AmbariClient)1 AmbariConnectionException (com.sequenceiq.ambari.client.AmbariConnectionException)1 UPDATE_IN_PROGRESS (com.sequenceiq.cloudbreak.api.model.Status.UPDATE_IN_PROGRESS)1 CancellationException (com.sequenceiq.cloudbreak.cloud.scheduler.CancellationException)1 BadRequestException (com.sequenceiq.cloudbreak.controller.BadRequestException)1 HostGroup (com.sequenceiq.cloudbreak.domain.HostGroup)1 HostMetadata (com.sequenceiq.cloudbreak.domain.HostMetadata)1 Stack (com.sequenceiq.cloudbreak.domain.Stack)1 HostMetadataRepository (com.sequenceiq.cloudbreak.repository.HostMetadataRepository)1 CloudbreakException (com.sequenceiq.cloudbreak.service.CloudbreakException)1 CloudbreakServiceException (com.sequenceiq.cloudbreak.service.CloudbreakServiceException)1 PollingResult (com.sequenceiq.cloudbreak.service.PollingResult)1 PollingResult.isExited (com.sequenceiq.cloudbreak.service.PollingResult.isExited)1 PollingResult.isTimeout (com.sequenceiq.cloudbreak.service.PollingResult.isTimeout)1 AMBARI_CLUSTER_SERVICES_STARTING (com.sequenceiq.cloudbreak.service.cluster.ambari.AmbariMessages.AMBARI_CLUSTER_SERVICES_STARTING)1 AMBARI_CLUSTER_SERVICES_STOPPED (com.sequenceiq.cloudbreak.service.cluster.ambari.AmbariMessages.AMBARI_CLUSTER_SERVICES_STOPPED)1 AMBARI_CLUSTER_SERVICES_STOPPING (com.sequenceiq.cloudbreak.service.cluster.ambari.AmbariMessages.AMBARI_CLUSTER_SERVICES_STOPPING)1 AMBARI_CLUSTER_UPSCALE_FAILED (com.sequenceiq.cloudbreak.service.cluster.ambari.AmbariMessages.AMBARI_CLUSTER_UPSCALE_FAILED)1 STOP_AMBARI_PROGRESS_STATE (com.sequenceiq.cloudbreak.service.cluster.ambari.AmbariOperationType.STOP_AMBARI_PROGRESS_STATE)1