aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kevi...@apache.org
Subject git commit: Add a metric to count offers that do not provide sufficent resources to launch a GC Executor
Date Thu, 16 Oct 2014 17:54:56 GMT
Repository: incubator-aurora
Updated Branches:
  refs/heads/master 9534ea303 -> f2d0ca299


Add a metric to count offers that do not provide sufficent resources
to launch a GC Executor

Testing Done:
./gradlew -Pq build

Bugs closed: AURORA-843

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


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

Branch: refs/heads/master
Commit: f2d0ca299ad759e9720a5a82547f7bce8a427d53
Parents: 9534ea3
Author: Joe Smith <yasumoto7@gmail.com>
Authored: Thu Oct 16 10:48:34 2014 -0700
Committer: Kevin Sweeney <kevints@apache.org>
Committed: Thu Oct 16 10:48:34 2014 -0700

----------------------------------------------------------------------
 .../apache/aurora/scheduler/async/GcExecutorLauncher.java |  5 +++++
 .../aurora/scheduler/async/GcExecutorLauncherTest.java    | 10 ++++++++++
 2 files changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/f2d0ca29/src/main/java/org/apache/aurora/scheduler/async/GcExecutorLauncher.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/async/GcExecutorLauncher.java b/src/main/java/org/apache/aurora/scheduler/async/GcExecutorLauncher.java
index cfab578..dce88d7 100644
--- a/src/main/java/org/apache/aurora/scheduler/async/GcExecutorLauncher.java
+++ b/src/main/java/org/apache/aurora/scheduler/async/GcExecutorLauncher.java
@@ -89,6 +89,8 @@ public class GcExecutorLauncher implements TaskLauncher {
   static final String SYSTEM_TASK_PREFIX = "system-gc-";
   @VisibleForTesting
   static final String LOST_TASKS_STAT_NAME = "gc_executor_tasks_lost";
+  @VisibleForTesting
+  static final String INSUFFICIENT_OFFERS_STAT_NAME = "scheduler_gc_insufficient_offers";
   private static final String EXECUTOR_NAME = "aurora.gc";
 
   private final GcExecutorSettings settings;
@@ -99,6 +101,7 @@ public class GcExecutorLauncher implements TaskLauncher {
   private final Supplier<String> uuidGenerator;
   private final Map<String, Long> pulses;
   private final AtomicLong lostTasks;
+  private final AtomicLong insufficientOffers;
 
   @Inject
   GcExecutorLauncher(
@@ -142,6 +145,7 @@ public class GcExecutorLauncher implements TaskLauncher {
     this.uuidGenerator = requireNonNull(uuidGenerator);
     this.pulses = Collections.synchronizedMap(Maps.<String, Long>newHashMap());
     this.lostTasks = statsProvider.makeCounter(LOST_TASKS_STAT_NAME);
+    this.insufficientOffers = statsProvider.makeCounter(INSUFFICIENT_OFFERS_STAT_NAME);
   }
 
   @VisibleForTesting
@@ -196,6 +200,7 @@ public class GcExecutorLauncher implements TaskLauncher {
     boolean sufficient = Resources.from(offer).greaterThanOrEqual(TOTAL_GC_EXECUTOR_RESOURCES);
     if (!sufficient) {
       LOG.warning("Offer for host " + offer.getHostname() + " is too small for a GC executor");
+      insufficientOffers.incrementAndGet();
     }
     return sufficient;
   }

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/f2d0ca29/src/test/java/org/apache/aurora/scheduler/async/GcExecutorLauncherTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/async/GcExecutorLauncherTest.java b/src/test/java/org/apache/aurora/scheduler/async/GcExecutorLauncherTest.java
index f2d153f..d77f521 100644
--- a/src/test/java/org/apache/aurora/scheduler/async/GcExecutorLauncherTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/async/GcExecutorLauncherTest.java
@@ -56,6 +56,7 @@ import org.junit.Test;
 
 import static org.apache.aurora.gen.ScheduleStatus.FAILED;
 import static org.apache.aurora.gen.ScheduleStatus.SANDBOX_DELETED;
+import static org.apache.aurora.scheduler.async.GcExecutorLauncher.INSUFFICIENT_OFFERS_STAT_NAME;
 import static org.apache.aurora.scheduler.async.GcExecutorLauncher.LOST_TASKS_STAT_NAME;
 import static org.apache.aurora.scheduler.async.GcExecutorLauncher.SYSTEM_TASK_PREFIX;
 import static org.easymock.EasyMock.expect;
@@ -89,6 +90,7 @@ public class GcExecutorLauncherTest extends EasyMockTest {
   private StatsProvider statsProvider;
   private GcExecutorLauncher gcExecutorLauncher;
   private AtomicLong lostTasks;
+  private AtomicLong insufficientOffers;
 
   @Before
   public void setUp() {
@@ -98,10 +100,12 @@ public class GcExecutorLauncherTest extends EasyMockTest {
     driver = createMock(Driver.class);
     statsProvider = createMock(StatsProvider.class);
     lostTasks = new AtomicLong();
+    insufficientOffers = new AtomicLong();
   }
 
   private void replayAndConstruct() {
     expect(statsProvider.makeCounter(LOST_TASKS_STAT_NAME)).andReturn(lostTasks);
+    expect(statsProvider.makeCounter(INSUFFICIENT_OFFERS_STAT_NAME)).andReturn(insufficientOffers);
     control.replay();
     gcExecutorLauncher = new GcExecutorLauncher(
         SETTINGS,
@@ -151,6 +155,8 @@ public class GcExecutorLauncherTest extends EasyMockTest {
     // Fifth call - host item expires (regular delay), one task collected
     clock.advance(Amount.of(1L, Time.HOURS));
     assertTrue(gcExecutorLauncher.willUse(OFFER));
+
+    assertEquals(0, insufficientOffers.get());
   }
 
   @Test
@@ -165,7 +171,9 @@ public class GcExecutorLauncherTest extends EasyMockTest {
         .clearResources()
         .addAllResources(resources)
         .build();
+    assertEquals(0, insufficientOffers.get());
     assertFalse(gcExecutorLauncher.willUse(smallOffer));
+    assertEquals(1, insufficientOffers.get());
   }
 
   private static TaskStatus makeStatus(String taskId) {
@@ -193,6 +201,7 @@ public class GcExecutorLauncherTest extends EasyMockTest {
   @Test
   public void testGcExecutorDisabled() {
     expect(statsProvider.makeCounter(LOST_TASKS_STAT_NAME)).andReturn(lostTasks);
+    expect(statsProvider.makeCounter(INSUFFICIENT_OFFERS_STAT_NAME)).andReturn(insufficientOffers);
     control.replay();
 
     gcExecutorLauncher = new GcExecutorLauncher(
@@ -204,6 +213,7 @@ public class GcExecutorLauncherTest extends EasyMockTest {
         statsProvider,
         Suppliers.ofInstance("gc"));
     assertFalse(gcExecutorLauncher.willUse(OFFER));
+    assertEquals(0, insufficientOffers.get());
   }
 
   @Test


Mime
View raw message