Search in sources :

Example 6 with ScheduleUpdateEvent

use of com.netflix.titus.common.framework.scheduler.model.event.ScheduleUpdateEvent in project titus-control-plane by Netflix.

the class LocalSchedulerTransactionLoggerTest method testDoFormatNewAction.

@Test
public void testDoFormatNewAction() {
    Schedule firstCompleted = updateStatus(REFERENCE_SCHEDULE, newSchedulingStatus(SchedulingState.Succeeded));
    Schedule nextAction = firstCompleted.toBuilder().withCurrentAction(ScheduledAction.newBuilder().withId("reference").withStatus(newSchedulingStatus(SchedulingState.Waiting)).withIteration(ExecutionId.initial()).build()).withCompletedActions(Collections.singletonList(firstCompleted.getCurrentAction())).build();
    verify(LocalSchedulerTransactionLogger.doFormat(new ScheduleUpdateEvent(nextAction)));
}
Also used : Schedule(com.netflix.titus.common.framework.scheduler.model.Schedule) ScheduleUpdateEvent(com.netflix.titus.common.framework.scheduler.model.event.ScheduleUpdateEvent) Test(org.junit.Test)

Example 7 with ScheduleUpdateEvent

use of com.netflix.titus.common.framework.scheduler.model.event.ScheduleUpdateEvent 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

ScheduleUpdateEvent (com.netflix.titus.common.framework.scheduler.model.event.ScheduleUpdateEvent)7 Schedule (com.netflix.titus.common.framework.scheduler.model.Schedule)4 Test (org.junit.Test)4 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 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 ScheduleRemovedEvent (com.netflix.titus.common.framework.scheduler.model.event.ScheduleRemovedEvent)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