Search in sources :

Example 1 with InternalReconciliationEngine

use of com.netflix.titus.common.framework.reconciler.internal.InternalReconciliationEngine in project titus-control-plane by Netflix.

the class JobReconciliationFrameworkFactory method newInstance.

ReconciliationFramework<JobManagerReconcilerEvent> newInstance() {
    List<Pair<Job, List<Task>>> jobsAndTasks = loadJobsAndTasksFromStore(errorCollector);
    // initialize fenzo with running tasks
    List<InternalReconciliationEngine<JobManagerReconcilerEvent>> engines = new ArrayList<>();
    for (Pair<Job, List<Task>> pair : jobsAndTasks) {
        Job job = pair.getLeft();
        List<Task> tasks = pair.getRight();
        InternalReconciliationEngine<JobManagerReconcilerEvent> engine = newRestoredEngine(job, tasks);
        engines.add(engine);
        for (Task task : tasks) {
            Optional<Task> validatedTask = validateTask(task);
            if (!validatedTask.isPresent()) {
                errorCollector.invalidTaskRecord(task.getId());
            }
        }
    }
    errorCollector.failIfTooManyBadRecords();
    return new DefaultReconciliationFramework<>(engines, bootstrapModel -> newEngine(bootstrapModel, true), jobManagerConfiguration.getReconcilerIdleTimeoutMs(), jobManagerConfiguration.getReconcilerActiveTimeoutMs(), jobManagerConfiguration.getCheckpointIntervalMs(), INDEX_COMPARATORS, JOB_EVENT_FACTORY, registry, optionalScheduler);
}
Also used : Task(com.netflix.titus.api.jobmanager.model.job.Task) ArrayList(java.util.ArrayList) JobManagerReconcilerEvent(com.netflix.titus.master.jobmanager.service.event.JobManagerReconcilerEvent) DefaultReconciliationFramework(com.netflix.titus.common.framework.reconciler.internal.DefaultReconciliationFramework) List(java.util.List) ArrayList(java.util.ArrayList) InternalReconciliationEngine(com.netflix.titus.common.framework.reconciler.internal.InternalReconciliationEngine) Job(com.netflix.titus.api.jobmanager.model.job.Job) Pair(com.netflix.titus.common.util.tuple.Pair)

Aggregations

Job (com.netflix.titus.api.jobmanager.model.job.Job)1 Task (com.netflix.titus.api.jobmanager.model.job.Task)1 DefaultReconciliationFramework (com.netflix.titus.common.framework.reconciler.internal.DefaultReconciliationFramework)1 InternalReconciliationEngine (com.netflix.titus.common.framework.reconciler.internal.InternalReconciliationEngine)1 Pair (com.netflix.titus.common.util.tuple.Pair)1 JobManagerReconcilerEvent (com.netflix.titus.master.jobmanager.service.event.JobManagerReconcilerEvent)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1