aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject incubator-aurora git commit: Removing redundant scheduling loop in preemptor.
Date Fri, 27 Feb 2015 21:09:39 GMT
Repository: incubator-aurora
Updated Branches:
  refs/heads/master e8a0a9fa4 -> cb41ae9e9


Removing redundant scheduling loop in preemptor.

Context is that the removed code was attempting to mitigate
a race where we preempt a task unnecessarily because new offers
have arrived.  Given that preemption begins immediately after
we have passed over the offers, this additional pass is redundant.
Additionally, the race still exists (an offer could arrive
right after we preempt), so the mitigation is of dubious value.

Bugs closed: AURORA-1156

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


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

Branch: refs/heads/master
Commit: cb41ae9e9c9a4c88cc01baed7bf28d0dae4eb088
Parents: e8a0a9f
Author: Maxim Khutornenko <maxim@apache.org>
Authored: Fri Feb 27 13:09:19 2015 -0800
Committer: Maxim Khutornenko <maxim@apache.org>
Committed: Fri Feb 27 13:09:19 2015 -0800

----------------------------------------------------------------------
 .../async/preemptor/PreemptorImpl.java          | 27 ----------------
 .../async/preemptor/PreemptorImplTest.java      | 33 --------------------
 2 files changed, 60 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/cb41ae9e/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 833a3e0..ae56d1e 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
@@ -221,14 +221,6 @@ public class PreemptorImpl implements Preemptor {
         }
       };
 
-  private static final Function<HostOffer, IHostAttributes> OFFER_TO_ATTRIBUTES =
-      new Function<HostOffer, IHostAttributes>() {
-        @Override
-        public IHostAttributes apply(HostOffer offer) {
-          return offer.getAttributes();
-        }
-      };
-
   private final Function<PreemptionVictim, ResourceSlot> victimToResources =
       new Function<PreemptionVictim, ResourceSlot>() {
         @Override
@@ -270,25 +262,6 @@ public class PreemptorImpl implements Preemptor {
     ResourceSlot slackResources =
         ResourceSlot.sum(Iterables.transform(offers, OFFER_TO_RESOURCE_SLOT));
 
-    if (!Iterables.isEmpty(offers)) {
-      if (Iterables.size(offers) > 1) {
-        // There are multiple offers for the same host. Since both have maintenance information
-        // we don't preempt with this information and wait for mesos to merge the two offers
for
-        // us.
-        return Optional.absent();
-      }
-      IHostAttributes attributes = Iterables.getOnlyElement(
-          FluentIterable.from(offers).transform(OFFER_TO_ATTRIBUTES).toSet());
-
-      Set<SchedulingFilter.Veto> vetoes = schedulingFilter.filter(
-          new UnusedResource(slackResources, attributes),
-          new ResourceRequest(pendingTask.getTask(), pendingTask.getTaskId(), jobState));
-
-      if (vetoes.isEmpty()) {
-        return Optional.<Set<PreemptionVictim>>of(ImmutableSet.<PreemptionVictim>of());
-      }
-    }
-
     FluentIterable<PreemptionVictim> preemptableTasks = FluentIterable.from(possibleVictims)
         .filter(preemptionFilter(pendingTask.getTask()));
 

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/cb41ae9e/src/test/java/org/apache/aurora/scheduler/async/preemptor/PreemptorImplTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/async/preemptor/PreemptorImplTest.java
b/src/test/java/org/apache/aurora/scheduler/async/preemptor/PreemptorImplTest.java
index 2845b3f..8368076 100644
--- a/src/test/java/org/apache/aurora/scheduler/async/preemptor/PreemptorImplTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/async/preemptor/PreemptorImplTest.java
@@ -571,39 +571,6 @@ public class PreemptorImplTest extends EasyMockTest {
     assertEquals(0L, statsProvider.getLongValue(failureStatName(true)));
   }
 
-  // Ensures we don't preempt if a host has enough slack to satisfy a pending task.
-  @Test
-  public void testPreemptWithLargeOffer() throws Exception {
-    schedulingFilter = new SchedulingFilterImpl(TaskExecutors.NO_OVERHEAD_EXECUTOR);
-
-    setUpHost(HOST_A, RACK_A);
-
-    ScheduledTask a1 = makeTask(USER_A, JOB_A, TASK_ID_A + "_a1");
-    a1.getAssignedTask().getTask().setNumCpus(1).setRamMb(512);
-    runOnHost(a1, HOST_A);
-
-    Offer o1 = makeOffer(OFFER_A, HOST_A, 2, Amount.of(2048L, Data.MB), Amount.of(1L, Data.MB),
1);
-    expectOffers(o1);
-
-    ScheduledTask p1 = makeProductionTask(USER_B, JOB_B, TASK_ID_B + "_p1");
-    p1.getAssignedTask().getTask().setNumCpus(1).setRamMb(1024);
-
-    clock.advance(PREEMPTION_DELAY);
-
-    expectGetClusterState(a1);
-    expectGetPendingTasks(p1);
-
-    control.replay();
-    runPreemptor(p1);
-
-    assertEquals(0L, statsProvider.getLongValue(attemptsStatName(false)));
-    assertEquals(1L, statsProvider.getLongValue(attemptsStatName(true)));
-    assertEquals(0L, statsProvider.getLongValue(successStatName(false)));
-    assertEquals(0L, statsProvider.getLongValue(successStatName(true)));
-    assertEquals(0L, statsProvider.getLongValue(failureStatName(false)));
-    assertEquals(0L, statsProvider.getLongValue(failureStatName(true)));
-  }
-
   // TODO(zmanji) spread tasks across slave ids on the same host and see if preemption fails.
 
   private Offer makeOffer(String offerId,


Mime
View raw message