aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wfar...@apache.org
Subject incubator-aurora git commit: Only fetch host attributes once per preemption round.
Date Thu, 26 Feb 2015 07:27:20 GMT
Repository: incubator-aurora
Updated Branches:
  refs/heads/master 9442e0836 -> 938144cf7


Only fetch host attributes once per preemption round.

Bugs closed: AURORA-1153

Reviewed at https://reviews.apache.org/r/31456/


Project: http://git-wip-us.apache.org/repos/asf/incubator-aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-aurora/commit/938144cf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-aurora/tree/938144cf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-aurora/diff/938144cf

Branch: refs/heads/master
Commit: 938144cf792222354e0d79e8f1971b44fc89b0f5
Parents: 9442e08
Author: Bill Farner <wfarner@apache.org>
Authored: Wed Feb 25 23:26:52 2015 -0800
Committer: Bill Farner <wfarner@apache.org>
Committed: Wed Feb 25 23:26:52 2015 -0800

----------------------------------------------------------------------
 .../scheduler/async/preemptor/PreemptorImpl.java      | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/938144cf/src/main/java/org/apache/aurora/scheduler/async/preemptor/PreemptorImpl.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/async/preemptor/PreemptorImpl.java
b/src/main/java/org/apache/aurora/scheduler/async/preemptor/PreemptorImpl.java
index 42af883..a4e8dd3 100644
--- a/src/main/java/org/apache/aurora/scheduler/async/preemptor/PreemptorImpl.java
+++ b/src/main/java/org/apache/aurora/scheduler/async/preemptor/PreemptorImpl.java
@@ -214,8 +214,6 @@ public class PreemptorImpl implements Preemptor {
         .addAll(Iterables.transform(possibleVictims, VICTIM_TO_HOST))
         .addAll(Iterables.transform(offers, OFFER_TO_HOST)).build();
 
-    String host = Iterables.getOnlyElement(hosts);
-
     ResourceSlot slackResources =
         ResourceSlot.sum(Iterables.transform(offers, OFFER_TO_RESOURCE_SLOT));
 
@@ -249,6 +247,12 @@ public class PreemptorImpl implements Preemptor {
 
     Iterable<PreemptionVictim> sortedVictims = resourceOrder.immutableSortedCopy(preemptableTasks);
 
+    Optional<IHostAttributes> attributes = getHostAttributes(Iterables.getOnlyElement(hosts));
+    if (!attributes.isPresent()) {
+      missingAttributes.incrementAndGet();
+      return Optional.absent();
+    }
+
     for (PreemptionVictim victim : sortedVictims) {
       toPreemptTasks.add(victim);
 
@@ -256,12 +260,6 @@ public class PreemptorImpl implements Preemptor {
           ResourceSlot.sum(Iterables.transform(toPreemptTasks, victimToResources)),
           slackResources);
 
-      Optional<IHostAttributes> attributes = getHostAttributes(host);
-      if (!attributes.isPresent()) {
-        missingAttributes.incrementAndGet();
-        continue;
-      }
-
       Set<SchedulingFilter.Veto> vetoes = schedulingFilter.filter(
           new UnusedResource(totalResource, attributes.get()),
           new ResourceRequest(pendingTask.getTask(), pendingTask.getTaskId(), jobState));


Mime
View raw message