New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better task balancing #1482

Merged
merged 73 commits into from Jun 8, 2017
Commits
Jump to file or symbol
Failed to load files and symbols.
+4 鈭1
Diff settings

Always

Just for now

Viewing a subset of changes. View all

don't update list while iterating on it...

  • Loading branch information...
darcatron committed Apr 28, 2017
commit 0292cb59736ac491d9ccaae81fd9ac2eecacf1e1
@@ -1,5 +1,6 @@
package com.hubspot.singularity.mesos;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
@@ -129,6 +130,7 @@ public SingularityMesosOfferScheduler(MesosConfiguration mesosConfiguration,
while (!pendingTaskIdToTaskRequest.isEmpty() && addedTaskInLastLoop && canScheduleAdditionalTasks(taskCredits)) {
addedTaskInLastLoop = false;
List<String> acceptedTasks = new ArrayList<>();
for (SingularityTaskRequestHolder taskRequestHolder : pendingTaskIdToTaskRequest.values()) {
@@ -170,13 +172,14 @@ public SingularityMesosOfferScheduler(MesosConfiguration mesosConfiguration,
}
bestOffer.addMatchedTask(task);
addedTaskInLastLoop = true;
pendingTaskIdToTaskRequest.remove(task.getTaskRequest().getPendingTask().getPendingTaskId().getId());
acceptedTasks.add(task.getTaskRequest().getPendingTask().getPendingTaskId().getId());
if (useTaskCredits && taskCredits == 0) {
LOG.info("Used all available task credits, not scheduling any more tasks");
break;
}
}
}
acceptedTasks.forEach(pendingTaskIdToTaskRequest::remove);
}
if (useTaskCredits) {
ProTip! Use n and p to navigate between commits in a pull request.