Search in sources :

Example 1 with MesosOfferObject

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());
}
Also used : TaskInfo(org.apache.mesos.v1.Protos.TaskInfo) MesosOfferObject(com.hubspot.mesos.protos.MesosOfferObject) SingularityTask(com.hubspot.singularity.SingularityTask) SingularityDeployBuilder(com.hubspot.singularity.SingularityDeployBuilder) SingularityTaskRequest(com.hubspot.singularity.SingularityTaskRequest)

Aggregations

MesosOfferObject (com.hubspot.mesos.protos.MesosOfferObject)1 SingularityDeployBuilder (com.hubspot.singularity.SingularityDeployBuilder)1 SingularityTask (com.hubspot.singularity.SingularityTask)1 SingularityTaskRequest (com.hubspot.singularity.SingularityTaskRequest)1 TaskInfo (org.apache.mesos.v1.Protos.TaskInfo)1