use of com.netflix.titus.common.framework.reconciler.ModelActionHolder 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;
}
use of com.netflix.titus.common.framework.reconciler.ModelActionHolder in project titus-control-plane by Netflix.
the class CreateOrReplaceServiceTaskActions method createTaskResubmitModelActions.
private static List<ModelActionHolder> createTaskResubmitModelActions(TitusChangeAction.Builder changeActionBuilder, ServiceJobTask oldTask, ServiceJobTask newTask, Retryer nextTaskRetryer) {
List<ModelActionHolder> actions = new ArrayList<>();
TitusModelAction removeTaskAction = TitusModelAction.newModelUpdate(changeActionBuilder).summary("Removing replaced task").removeTask(oldTask);
actions.addAll(ModelActionHolder.allModels(removeTaskAction));
actions.addAll(createNewTaskModelAction(changeActionBuilder, newTask, Optional.of(oldTask), nextTaskRetryer));
return actions;
}
Aggregations