use of com.sequenceiq.cloudbreak.api.model.Status in project cloudbreak by hortonworks.
the class StackUpdater method doUpdateStackStatus.
private Stack doUpdateStackStatus(Long stackId, DetailedStackStatus detailedStatus, String statusReason) {
Stack stack = stackRepository.findOne(stackId);
Status status = detailedStatus.getStatus();
if (!stack.isDeleteCompleted()) {
stack.setStackStatus(new StackStatus(stack, status, statusReason, detailedStatus));
if (status.isRemovableStatus()) {
InMemoryStateStore.deleteStack(stackId);
if (stack.getCluster() != null && stack.getCluster().getStatus().isRemovableStatus()) {
InMemoryStateStore.deleteCluster(stack.getCluster().getId());
}
} else {
InMemoryStateStore.putStack(stackId, statusToPollGroupConverter.convert(status));
}
stack = stackRepository.save(stack);
}
return stack;
}
use of com.sequenceiq.cloudbreak.api.model.Status in project cloudbreak by hortonworks.
the class UptimeNotifier method sendUptime.
@Scheduled(fixedDelay = 60000)
public void sendUptime() {
EnumSet<Status> statuses = EnumSet.complementOf(EnumSet.of(Status.DELETE_COMPLETED));
List<Cluster> clusters = clusterRepository.findByStatuses(statuses);
for (Cluster cluster : clusters) {
Stack stack = stackRepository.findStackForCluster(cluster.getId());
if (stack != null && !stack.isDeleteCompleted()) {
Long uptime = stackUtil.getUptimeForCluster(cluster, cluster.isAvailable());
Notification<CloudbreakEventsJson> notification = createUptimeNotification(stack, uptime);
notificationSender.send(notification);
}
}
}
Aggregations