use of com.netflix.titus.api.containerhealth.model.ContainerHealthState in project titus-control-plane by Netflix.
the class AggregatingContainerHealthService method handleNewState.
private Flux<ContainerHealthEvent> handleNewState(Job<?> job, Task task, ConcurrentMap<String, ContainerHealthState> emittedStates) {
ContainerHealthStatus newStatus = takeStatusOf(job, task);
ContainerHealthState previousState = emittedStates.get(task.getId());
ContainerHealthState newState = newStatus.getState();
if (newState == previousState) {
return Flux.empty();
}
if (newState == ContainerHealthState.Terminated) {
emittedStates.remove(task.getId());
} else {
emittedStates.put(task.getId(), newState);
}
return Flux.just(ContainerHealthEvent.healthChanged(newStatus));
}
use of com.netflix.titus.api.containerhealth.model.ContainerHealthState in project titus-control-plane by Netflix.
the class EurekaContainerHealthService method handleTaskStateUpdate.
private Optional<ContainerHealthEvent> handleTaskStateUpdate(Job<?> job, Task task, ConcurrentMap<String, ContainerHealthEvent> state) {
ContainerHealthUpdateEvent lastEvent = (ContainerHealthUpdateEvent) state.get(task.getId());
if (lastEvent == null) {
return Optional.of(recordNewState(state, task, ContainerHealthEvent.healthChanged(buildHealthStatus(job, task))));
}
ContainerHealthState newTaskState = takeStateOf(job, task);
String newReason = takeStateReasonOf(job, task);
if (lastEvent.getContainerHealthStatus().getState() == newTaskState && lastEvent.getContainerHealthStatus().getReason().equals(newReason)) {
return Optional.empty();
}
return Optional.of(recordNewState(state, task, ContainerHealthEvent.healthChanged(buildHealthStatus(task, newTaskState, newReason))));
}
Aggregations