use of com.sequenceiq.cloudbreak.api.endpoint.v4.common.Status in project cloudbreak by hortonworks.
the class StackUpdater method saveDeprecatedClusterStatus.
private void saveDeprecatedClusterStatus(String statusReason, Stack stack, Status newStatus) {
Cluster cluster = stack.getCluster();
if (cluster != null) {
Status previous = cluster.getStatus();
LOGGER.debug("Update deprecated cluster status from: {} to: {} reason: {} cluster: {}", previous, newStatus, statusReason, cluster.getId());
cluster.setStatus(newStatus);
cluster.setStatusReason(statusReason);
clusterService.save(cluster);
}
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.common.Status in project cloudbreak by hortonworks.
the class ClusterCommonService method saveAndFireEventOnClusterStatusChange.
private void saveAndFireEventOnClusterStatusChange(Stack stack, DetailedStackStatus newDetailedStackStatus, ResourceEvent event) {
Status actualStatus = stack.getStatus();
if (!actualStatus.equals(newDetailedStackStatus.getStatus())) {
clusterService.updateClusterStatusByStackId(stack.getId(), newDetailedStackStatus);
cloudbreakEventService.fireCloudbreakEvent(stack.getId(), event.name(), event);
}
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.common.Status in project cloudbreak by hortonworks.
the class LoadBalancerPollerService method periodicCheckForCompletion.
private AttemptResult<List<FlowIdentifier>> periodicCheckForCompletion(List<FlowIdentifier> flowIdentifiers) {
try {
boolean anyFlowsActive = false;
for (FlowIdentifier flowIdentifier : flowIdentifiers) {
Boolean hasActiveFlow = ThreadBasedUserCrnProvider.doAsInternalActor(regionAwareInternalCrnGeneratorFactory.iam().getInternalCrnForServiceAsString(), () -> flowEndpoint.hasFlowRunningByFlowId(flowIdentifier.getPollableId()).getHasActiveFlow());
if (hasActiveFlow) {
LOGGER.debug("Flow {} is still running", flowIdentifier.getPollableId());
} else {
LOGGER.debug("Flow {} is complete", flowIdentifier.getPollableId());
}
anyFlowsActive = anyFlowsActive || hasActiveFlow;
}
if (anyFlowsActive) {
return AttemptResults.justContinue();
} else {
List<FlowIdentifier> failedFlows = flowIdentifiers.stream().filter(flowId -> hasFlowFailed(ThreadBasedUserCrnProvider.doAsInternalActor(regionAwareInternalCrnGeneratorFactory.iam().getInternalCrnForServiceAsString(), () -> flowEndpoint.getFlowLogsByFlowId(flowId.getPollableId())))).collect(Collectors.toList());
return AttemptResults.finishWith(failedFlows);
}
} catch (Exception e) {
LOGGER.warn("Failure checking status of flows {}, error is: {}", flowIdentifiers, e.getMessage());
return AttemptResults.breakFor(e);
}
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.common.Status in project cloudbreak by hortonworks.
the class ClusterStatusUpdater method updateClusterStatus.
private boolean updateClusterStatus(Stack stack, ClusterStatus clusterStatus) {
boolean result = false;
Cluster cluster = stack.getCluster();
Status actualStatus = stack.getStatus();
DetailedStackStatus newDetailedStackStatus = clusterStatus.getDetailedStackStatus();
Status newStatus = newDetailedStackStatus.getStatus();
if (actualStatus != newStatus) {
if (!actualStatus.equals(Status.MAINTENANCE_MODE_ENABLED) || !newStatus.equals(Status.AVAILABLE)) {
LOGGER.debug("Cluster {} status is updated from {} to {}/{}", cluster.getId(), actualStatus, newStatus, newDetailedStackStatus);
clusterService.updateClusterStatusByStackId(stack.getId(), newDetailedStackStatus, clusterStatus.getStatusReason());
result = true;
}
} else {
LOGGER.debug("Cluster {} status hasn't changed: {}", cluster.getId(), actualStatus);
}
return result;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.common.Status in project cloudbreak by hortonworks.
the class UpgradePreconditionServiceTest method createClusterResponse.
private ClusterViewV4Response createClusterResponse(Status clusterStatus, BlueprintBasedUpgradeOption upgradeable) {
ClusterViewV4Response dataHubCluster = new ClusterViewV4Response();
dataHubCluster.setStatus(clusterStatus);
BlueprintV4ViewResponse blueprint = new BlueprintV4ViewResponse();
blueprint.setUpgradeable(upgradeable);
dataHubCluster.setBlueprint(blueprint);
return dataHubCluster;
}
Aggregations