Search in sources :

Example 6 with PollGroup

use of com.sequenceiq.cloudbreak.cloud.scheduler.PollGroup in project cloudbreak by hortonworks.

the class ClusterDeletionBasedExitCriteria method isExitNeeded.

@Override
public boolean isExitNeeded(ExitCriteriaModel exitCriteriaModel) {
    ClusterDeletionBasedExitCriteriaModel model = (ClusterDeletionBasedExitCriteriaModel) exitCriteriaModel;
    LOGGER.debug("Check isExitNeeded for model: {}", model);
    PollGroup stackPollGroup = InMemoryStateStore.getStack(model.getStackId());
    if (stackPollGroup != null && CANCELLED.equals(stackPollGroup)) {
        LOGGER.warn("Stack is getting terminated, polling is cancelled.");
        return true;
    }
    if (model.getClusterId() != null) {
        PollGroup clusterPollGroup = InMemoryStateStore.getCluster(model.getClusterId());
        if (clusterPollGroup != null && CANCELLED.equals(clusterPollGroup)) {
            LOGGER.warn("Cluster is getting terminated, polling is cancelled.");
            return true;
        }
    }
    return false;
}
Also used : PollGroup(com.sequenceiq.cloudbreak.cloud.scheduler.PollGroup)

Example 7 with PollGroup

use of com.sequenceiq.cloudbreak.cloud.scheduler.PollGroup in project cloudbreak by hortonworks.

the class StackDeletionBasedExitCriteria method isExitNeeded.

@Override
public boolean isExitNeeded(ExitCriteriaModel exitCriteriaModel) {
    StackDeletionBasedExitCriteriaModel model = (StackDeletionBasedExitCriteriaModel) exitCriteriaModel;
    LOGGER.debug("Check isExitNeeded for model: {}", model);
    PollGroup pollGroup = InMemoryStateStore.getStack(model.getStackId());
    if (pollGroup != null && CANCELLED.equals(pollGroup)) {
        LOGGER.warn("Stack is getting terminated, polling is cancelled.");
        return true;
    }
    return false;
}
Also used : PollGroup(com.sequenceiq.cloudbreak.cloud.scheduler.PollGroup)

Aggregations

PollGroup (com.sequenceiq.cloudbreak.cloud.scheduler.PollGroup)7 List (java.util.List)4 CloudResource (com.sequenceiq.cloudbreak.cloud.model.CloudResource)3 CloudResourceStatus (com.sequenceiq.cloudbreak.cloud.model.CloudResourceStatus)3 ArrayList (java.util.ArrayList)3 CloudContext (com.sequenceiq.cloudbreak.cloud.context.CloudContext)2 ResourceNotNeededException (com.sequenceiq.cloudbreak.cloud.template.ResourceNotNeededException)2 CloudVmInstanceStatus (com.sequenceiq.cloudbreak.cloud.model.CloudVmInstanceStatus)1 Group (com.sequenceiq.cloudbreak.cloud.model.Group)1 CancellationException (com.sequenceiq.cloudbreak.cloud.scheduler.CancellationException)1 ComputeResourceBuilder (com.sequenceiq.cloudbreak.cloud.template.ComputeResourceBuilder)1 GroupResourceBuilder (com.sequenceiq.cloudbreak.cloud.template.GroupResourceBuilder)1 NetworkResourceBuilder (com.sequenceiq.cloudbreak.cloud.template.NetworkResourceBuilder)1