aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zma...@apache.org
Subject aurora git commit: Use TaskStatus Reason to set memory limit message.
Date Wed, 03 Jun 2015 18:15:20 GMT
Repository: aurora
Updated Branches:
  refs/heads/master 54d561eee -> ed4415c12


Use TaskStatus Reason to set memory limit message.

Use TaskStatus Reason to set memory limit message instead of checking the
contents of the message field. Future versions of Mesos can change the
diagnostic information in the message field causing Aurora to display no
information when a task fails.

Testing Done:
./gradlew test -Pq

Bugs closed: AURORA-1341

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


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

Branch: refs/heads/master
Commit: ed4415c1241ab26d736cca6613ecfd91ca9915ee
Parents: 54d561e
Author: Zameer Manji <zmanji@apache.org>
Authored: Wed Jun 3 11:15:06 2015 -0700
Committer: zmanji@apache.org <zmanji@twitter.com>
Committed: Wed Jun 3 11:15:06 2015 -0700

----------------------------------------------------------------------
 .../aurora/scheduler/UserTaskLauncher.java      | 10 ++-----
 .../aurora/scheduler/UserTaskLauncherTest.java  | 31 ++++----------------
 2 files changed, 7 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aurora/blob/ed4415c1/src/main/java/org/apache/aurora/scheduler/UserTaskLauncher.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/UserTaskLauncher.java b/src/main/java/org/apache/aurora/scheduler/UserTaskLauncher.java
index 5af691d..6bfbf0c 100644
--- a/src/main/java/org/apache/aurora/scheduler/UserTaskLauncher.java
+++ b/src/main/java/org/apache/aurora/scheduler/UserTaskLauncher.java
@@ -58,9 +58,6 @@ public class UserTaskLauncher extends AbstractExecutionThreadService implements
   private static final Logger LOG = Logger.getLogger(UserTaskLauncher.class.getName());
 
   @VisibleForTesting
-  static final String MEMORY_LIMIT_EXCEEDED = "MEMORY STATISTICS";
-
-  @VisibleForTesting
   static final String MEMORY_LIMIT_DISPLAY = "Task used more memory than requested.";
 
   private static final String STATUS_STAT_FORMAT = "status_update_%s_%s";
@@ -180,11 +177,8 @@ public class UserTaskLauncher extends AbstractExecutionThreadService
implements
                 message = Optional.of(status.getMessage());
               }
 
-              // TODO(William Farner): Remove this hack once Mesos API change is done.
-              //                       Tracked by: https://issues.apache.org/jira/browse/MESOS-343
-              if (translatedState == ScheduleStatus.FAILED
-                  && message.isPresent()
-                  && message.get().contains(MEMORY_LIMIT_EXCEEDED)) {
+              if (translatedState == ScheduleStatus.FAILED && status.hasReason()
+                  && status.getReason() == TaskStatus.Reason.REASON_MEMORY_LIMIT)
{
                 message = Optional.of(MEMORY_LIMIT_DISPLAY);
               }
 

http://git-wip-us.apache.org/repos/asf/aurora/blob/ed4415c1/src/test/java/org/apache/aurora/scheduler/UserTaskLauncherTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/UserTaskLauncherTest.java b/src/test/java/org/apache/aurora/scheduler/UserTaskLauncherTest.java
index fe2fc95..126001a 100644
--- a/src/test/java/org/apache/aurora/scheduler/UserTaskLauncherTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/UserTaskLauncherTest.java
@@ -178,44 +178,23 @@ public class UserTaskLauncherTest extends EasyMockTest {
   }
 
   @Test
-  public void testMemoryLimitTranslationHack() throws Exception {
+  public void testMemoryLimitTranslation() throws Exception {
     storageUtil.expectWrite();
 
     TaskStatus status = TaskStatus.newBuilder()
         .setState(TaskState.TASK_FAILED)
         .setTaskId(TaskID.newBuilder().setValue(TASK_ID_A))
-        .setMessage("Memory limit exceeded: Requested 256MB, Used 256MB.\n\n"
-            + "MEMORY STATISTICS: \n"
-            + "cache 20422656\n"
-            + "rss 248012800\n"
-            + "mapped_file 8192\n"
-            + "pgpgin 28892\n"
-            + "pgpgout 6791\n"
-            + "inactive_anon 90112\n"
-            + "active_anon 245768192\n"
-            + "inactive_file 19685376\n"
-            + "active_file 700416\n"
-            + "unevictable 0\n"
-            + "hierarchical_memory_limit 268435456\n"
-            + "total_cache 20422656\n"
-            + "total_rss 248012800\n"
-            + "total_mapped_file 8192\n"
-            + "total_pgpgin 28892\n"
-            + "total_pgpgout 6791\n"
-            + "total_inactive_anon 90112\n"
-            + "total_active_anon 245768192\n"
-            + "total_inactive_file 19685376\n"
-            + "total_active_file 700416\n"
-            + "total_unevictable 0 ")
+        .setReason(TaskStatus.Reason.REASON_MEMORY_LIMIT)
+        .setMessage("Some Message")
         .build();
 
     expect(stateManager.changeState(
         storageUtil.mutableStoreProvider,
         TASK_ID_A,
-        Optional.<ScheduleStatus>absent(),
+        Optional.absent(),
         FAILED,
         Optional.of(UserTaskLauncher.MEMORY_LIMIT_DISPLAY)))
-        .andReturn(StateChangeResult.ILLEGAL);
+        .andReturn(StateChangeResult.SUCCESS);
 
     final CountDownLatch latch = new CountDownLatch(1);
 


Mime
View raw message