use of com.netflix.titus.common.framework.scheduler.model.event.ScheduleRemovedEvent in project titus-control-plane by Netflix.
the class DefaultLocalSchedulerTest method expectScheduleRemoved.
private void expectScheduleRemoved(ScheduleReference reference) throws InterruptedException {
assertThat(reference.isClosed()).isTrue();
LocalSchedulerEvent removedEvent = eventSubscriber.takeUntil(e -> e instanceof ScheduleRemovedEvent, Duration.ofSeconds(5));
Schedule schedule = removedEvent.getSchedule();
assertThat(schedule.getCurrentAction().getStatus().getState().isFinal()).isTrue();
assertThat(localScheduler.getArchivedSchedules()).hasSize(1);
assertThat(localScheduler.getArchivedSchedules().get(0).getId()).isEqualTo(reference.getSchedule().getId());
}
use of com.netflix.titus.common.framework.scheduler.model.event.ScheduleRemovedEvent in project titus-control-plane by Netflix.
the class DefaultLocalSchedulerPerf method observeEvents.
private void observeEvents(ScheduleReference reference) {
localScheduler.events().filter(e -> e.getSchedule().getId().equals(reference.getSchedule().getId())).subscribe(event -> {
if (event instanceof ScheduleUpdateEvent) {
ScheduleUpdateEvent updateEvent = (ScheduleUpdateEvent) event;
ScheduledAction action = updateEvent.getSchedule().getCurrentAction();
if (action.getStatus().getState() == SchedulingStatus.SchedulingState.Failed) {
eventFailures.incrementAndGet();
}
} else if (event instanceof ScheduleRemovedEvent) {
removedEvents.incrementAndGet();
}
});
}
Aggregations