use of com.hubspot.mesos.protos.MesosOfferObject in project Singularity by HubSpot.
the class SingularityTaskSizeOptimizer method getSizeOptimizedTask.
SingularityTask getSizeOptimizedTask(SingularityMesosTaskHolder taskHolder) {
if (configuration.isStoreAllMesosTaskInfoForDebugging()) {
return taskHolder.getTask();
}
SingularityTask task = taskHolder.getTask();
TaskInfo.Builder mesosTask = taskHolder.getMesosTask().toBuilder();
mesosTask.clearData();
List<MesosOfferObject> offers = task.getOffers().stream().map(MesosOfferObject::sizeOptimized).collect(Collectors.toList());
SingularityTaskRequest taskRequest = task.getTaskRequest();
if (task.getTaskRequest().getDeploy().getExecutorData().isPresent()) {
SingularityDeployBuilder deploy = task.getTaskRequest().getDeploy().toBuilder();
deploy.setExecutorData(Optional.absent());
taskRequest = new SingularityTaskRequest(task.getTaskRequest().getRequest(), deploy.build(), task.getTaskRequest().getPendingTask());
}
return new SingularityTask(taskRequest, task.getTaskId(), offers, mesosProtosUtils.taskFromProtos(mesosTask.build()), task.getRackId());
}
Aggregations