Search in sources :

Example 6 with ScheduleDescriptor

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

the class BaseGcController method enterActiveMode.

@Activator
public void enterActiveMode() {
    ScheduleDescriptor gcScheduleDescriptor = ScheduleDescriptor.newBuilder().withName(name).withDescription(description).withInitialDelay(Duration.ofMillis(controllerConfiguration.getControllerInitialDelayMs())).withInterval(Duration.ofMillis(controllerConfiguration.getControllerIntervalMs())).withTimeout(Duration.ofMillis(controllerConfiguration.getControllerTimeoutMs())).build();
    executorService = ExecutorsExt.namedSingleThreadExecutor(name);
    schedulerRef = scheduler.schedule(gcScheduleDescriptor, e -> doGc(), executorService);
    tokenBucket = Limiters.createInstrumentedFixedIntervalTokenBucket(name + "TokenBucket", tokenBucketConfiguration, currentTokenBucket -> logger.info("Token bucket: {} configuration updated with: {}", name, currentTokenBucket), titusRuntime);
}
Also used : ExecutorsExt(com.netflix.titus.common.util.ExecutorsExt) Gauge(com.netflix.spectator.api.Gauge) Logger(org.slf4j.Logger) LoggerFactory(org.slf4j.LoggerFactory) MetricConstants(com.netflix.titus.master.MetricConstants) ScheduleReference(com.netflix.titus.common.framework.scheduler.ScheduleReference) Activator(com.netflix.titus.common.util.guice.annotation.Activator) FixedIntervalTokenBucketConfiguration(com.netflix.titus.common.util.limiter.tokenbucket.FixedIntervalTokenBucketConfiguration) PreDestroy(javax.annotation.PreDestroy) List(java.util.List) ScheduleDescriptor(com.netflix.titus.common.framework.scheduler.model.ScheduleDescriptor) Duration(java.time.Duration) Limiters(com.netflix.titus.common.util.limiter.Limiters) Named(javax.inject.Named) TitusRuntime(com.netflix.titus.common.runtime.TitusRuntime) TokenBucket(com.netflix.titus.common.util.limiter.tokenbucket.TokenBucket) Evaluators(com.netflix.titus.common.util.Evaluators) Collections(java.util.Collections) Deactivator(com.netflix.titus.common.util.guice.annotation.Deactivator) ExecutorService(java.util.concurrent.ExecutorService) LocalScheduler(com.netflix.titus.common.framework.scheduler.LocalScheduler) ScheduleDescriptor(com.netflix.titus.common.framework.scheduler.model.ScheduleDescriptor) Activator(com.netflix.titus.common.util.guice.annotation.Activator)

Aggregations

ScheduleDescriptor (com.netflix.titus.common.framework.scheduler.model.ScheduleDescriptor)6 Activator (com.netflix.titus.common.util.guice.annotation.Activator)4 Gauge (com.netflix.spectator.api.Gauge)3 ScheduleReference (com.netflix.titus.common.framework.scheduler.ScheduleReference)3 TitusRuntime (com.netflix.titus.common.runtime.TitusRuntime)3 Evaluators (com.netflix.titus.common.util.Evaluators)3 ExecutorsExt (com.netflix.titus.common.util.ExecutorsExt)3 Deactivator (com.netflix.titus.common.util.guice.annotation.Deactivator)3 Duration (java.time.Duration)3 List (java.util.List)3 PreDestroy (javax.annotation.PreDestroy)3 Logger (org.slf4j.Logger)3 LoggerFactory (org.slf4j.LoggerFactory)3 Registry (com.netflix.spectator.api.Registry)2 Task (com.netflix.titus.api.jobmanager.model.job.Task)2 TaskState (com.netflix.titus.api.jobmanager.model.job.TaskState)2 V3JobOperations (com.netflix.titus.api.jobmanager.service.V3JobOperations)2 FixedIntervalTokenBucketConfiguration (com.netflix.titus.common.util.limiter.tokenbucket.FixedIntervalTokenBucketConfiguration)2 MetricConstants (com.netflix.titus.master.MetricConstants)2 ArrayList (java.util.ArrayList)2