Search in sources :

Example 1 with ScheduleRemovedEvent

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());
}
Also used : ScheduleRemovedEvent(com.netflix.titus.common.framework.scheduler.model.event.ScheduleRemovedEvent) LocalSchedulerEvent(com.netflix.titus.common.framework.scheduler.model.event.LocalSchedulerEvent) Schedule(com.netflix.titus.common.framework.scheduler.model.Schedule)

Example 2 with ScheduleRemovedEvent

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();
        }
    });
}
Also used : SchedulingStatus(com.netflix.titus.common.framework.scheduler.model.SchedulingStatus) Clocks(com.netflix.titus.common.util.time.Clocks) ExecutionContext(com.netflix.titus.common.framework.scheduler.ExecutionContext) ScheduleRemovedEvent(com.netflix.titus.common.framework.scheduler.model.event.ScheduleRemovedEvent) Set(java.util.Set) Mono(reactor.core.publisher.Mono) ScheduleReference(com.netflix.titus.common.framework.scheduler.ScheduleReference) HashSet(java.util.HashSet) AtomicLong(java.util.concurrent.atomic.AtomicLong) DefaultRegistry(com.netflix.spectator.api.DefaultRegistry) ScheduleDescriptor(com.netflix.titus.common.framework.scheduler.model.ScheduleDescriptor) Duration(java.time.Duration) ScheduleUpdateEvent(com.netflix.titus.common.framework.scheduler.model.event.ScheduleUpdateEvent) Schedulers(reactor.core.scheduler.Schedulers) ScheduledAction(com.netflix.titus.common.framework.scheduler.model.ScheduledAction) LocalScheduler(com.netflix.titus.common.framework.scheduler.LocalScheduler) ScheduleRemovedEvent(com.netflix.titus.common.framework.scheduler.model.event.ScheduleRemovedEvent) ScheduledAction(com.netflix.titus.common.framework.scheduler.model.ScheduledAction) ScheduleUpdateEvent(com.netflix.titus.common.framework.scheduler.model.event.ScheduleUpdateEvent)

Aggregations

ScheduleRemovedEvent (com.netflix.titus.common.framework.scheduler.model.event.ScheduleRemovedEvent)2 DefaultRegistry (com.netflix.spectator.api.DefaultRegistry)1 ExecutionContext (com.netflix.titus.common.framework.scheduler.ExecutionContext)1 LocalScheduler (com.netflix.titus.common.framework.scheduler.LocalScheduler)1 ScheduleReference (com.netflix.titus.common.framework.scheduler.ScheduleReference)1 Schedule (com.netflix.titus.common.framework.scheduler.model.Schedule)1 ScheduleDescriptor (com.netflix.titus.common.framework.scheduler.model.ScheduleDescriptor)1 ScheduledAction (com.netflix.titus.common.framework.scheduler.model.ScheduledAction)1 SchedulingStatus (com.netflix.titus.common.framework.scheduler.model.SchedulingStatus)1 LocalSchedulerEvent (com.netflix.titus.common.framework.scheduler.model.event.LocalSchedulerEvent)1 ScheduleUpdateEvent (com.netflix.titus.common.framework.scheduler.model.event.ScheduleUpdateEvent)1 Clocks (com.netflix.titus.common.util.time.Clocks)1 Duration (java.time.Duration)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 Mono (reactor.core.publisher.Mono)1 Schedulers (reactor.core.scheduler.Schedulers)1