use of com.netflix.titus.common.framework.reconciler.EntityHolder in project titus-control-plane by Netflix.
the class CreateOrReplaceServiceTaskActions method createNewTaskModelAction.
private static List<ModelActionHolder> createNewTaskModelAction(TitusChangeAction.Builder changeActionBuilder, ServiceJobTask newTask, Optional<ServiceJobTask> replacementOf, Retryer newRetryer) {
List<ModelActionHolder> actions = new ArrayList<>();
String summary = "Creating new task entity holder";
TitusModelAction.Builder modelBuilder = TitusModelAction.newModelUpdate(changeActionBuilder).summary(summary);
EntityHolder taskHolder = EntityHolder.newRoot(newTask.getId(), newTask).addTag(TaskRetryers.ATTR_TASK_RETRY, newRetryer);
if (replacementOf.isPresent()) {
taskHolder = taskHolder.addTag(ATTR_REPLACEMENT_OF, replacementOf.get());
}
actions.add(ModelActionHolder.reference(modelBuilder.addTaskHolder(taskHolder)));
actions.add(ModelActionHolder.store(modelBuilder.taskUpdate(newTask)));
return actions;
}
Aggregations