use of com.hubspot.singularity.SingularityTaskRequestWithPriority in project Singularity by HubSpot.
the class SingularityMesosTaskPrioritizer method getSortedDueTasks.
public List<SingularityTaskRequest> getSortedDueTasks(List<SingularityTaskRequest> dueTasks) {
long now = System.currentTimeMillis();
List<SingularityTaskRequestWithPriority> taskRequestWithPriorities = new ArrayList<>();
for (SingularityTaskRequest taskRequest : dueTasks) {
taskRequestWithPriorities.add(new SingularityTaskRequestWithPriority(taskRequest, getWeightedPriority(taskRequest, now)));
}
Collections.sort(taskRequestWithPriorities, SingularityTaskRequestWithPriority.weightedPriorityComparator());
List<SingularityTaskRequest> taskRequests = new ArrayList<>();
for (SingularityTaskRequestWithPriority taskRequestWithPriority : taskRequestWithPriorities) {
taskRequests.add(taskRequestWithPriority.getTaskRequest());
}
return taskRequests;
}
Aggregations