addendum patch for YARN-7289.

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

Branch: refs/heads/YARN-1011
Commit: 940ffe3f9ce74286a8863e3743faf88a33c817a3
Parents: 0cc98ae
Author: Rohith Sharma K S <rohithsharm...@apache.org>
Authored: Thu Nov 2 13:55:19 2017 +0530
Committer: Rohith Sharma K S <rohithsharm...@apache.org>
Committed: Thu Nov 2 13:55:19 2017 +0530

----------------------------------------------------------------------
 .../scheduler/AbstractYarnScheduler.java        |  4 ++--
 .../scheduler/capacity/CapacityScheduler.java   |  2 +-
 .../rmapp/TestApplicationLifetimeMonitor.java   | 24 +++++++++++---------
 3 files changed, 16 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/940ffe3f/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/AbstractYarnScheduler.java
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/AbstractYarnScheduler.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/AbstractYarnScheduler.java
index f2da1fe..8ce6eb8 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/AbstractYarnScheduler.java
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/AbstractYarnScheduler.java
@@ -1351,8 +1351,8 @@ public abstract class AbstractYarnScheduler
 
   @Override
   public long checkAndGetApplicationLifetime(String queueName, long lifetime) {
-    // -1 indicates, lifetime is not configured.
-    return -1;
+    // Lifetime is the application lifetime by default.
+    return lifetime;
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/hadoop/blob/940ffe3f/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacityScheduler.java
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacityScheduler.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacityScheduler.java
index d91aa55..ca289b1 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacityScheduler.java
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacityScheduler.java
@@ -2591,7 +2591,7 @@ public class CapacityScheduler extends
       long maximumApplicationLifetime =
           ((LeafQueue) queue).getMaximumApplicationLifetime();
 
-      // check only for maximum, that's enough because default cann't
+      // check only for maximum, that's enough because default can't
       // exceed maximum
       if (maximumApplicationLifetime <= 0) {
         return lifetimeRequestedByApp;

http://git-wip-us.apache.org/repos/asf/hadoop/blob/940ffe3f/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/TestApplicationLifetimeMonitor.java
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/TestApplicationLifetimeMonitor.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/TestApplicationLifetimeMonitor.java
index 4f88480..e1d8716 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/TestApplicationLifetimeMonitor.java
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/TestApplicationLifetimeMonitor.java
@@ -30,6 +30,7 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest;
 import 
org.apache.hadoop.yarn.api.protocolrecords.UpdateApplicationTimeoutsRequest;
@@ -72,6 +73,8 @@ import org.junit.runners.Parameterized;
  */
 @RunWith(Parameterized.class)
 public class TestApplicationLifetimeMonitor {
+  private final long maxLifetime = 30L;
+
   private YarnConfiguration conf;
 
   @Parameterized.Parameters
@@ -90,7 +93,16 @@ public class TestApplicationLifetimeMonitor {
 
   @Before
   public void setup() throws IOException {
-    conf = new YarnConfiguration();
+    if (scheduler.equals(CapacityScheduler.class)) {
+      // Since there is limited lifetime monitoring support in fair scheduler
+      // it does not need queue setup
+      long defaultLifetime = 15L;
+      Configuration capacitySchedulerConfiguration =
+          setUpCSQueue(maxLifetime, defaultLifetime);
+      conf = new YarnConfiguration(capacitySchedulerConfiguration);
+    } else {
+      conf = new YarnConfiguration();
+    }
     // Always run for CS, since other scheduler do not support this.
     conf.setClass(YarnConfiguration.RM_SCHEDULER,
         scheduler, ResourceScheduler.class);
@@ -106,16 +118,6 @@ public class TestApplicationLifetimeMonitor {
       throws Exception {
     MockRM rm = null;
     try {
-      long maxLifetime = 30L;
-      long defaultLifetime = 15L;
-
-      YarnConfiguration newConf;
-      if (scheduler.equals(CapacityScheduler.class)) {
-        // Since there is limited lifetime monitoring support in fair scheduler
-        // it does not need queue setup
-        conf =
-            new YarnConfiguration(setUpCSQueue(maxLifetime, defaultLifetime));
-      }
       rm = new MockRM(conf);
       rm.start();
 


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-commits-h...@hadoop.apache.org

Reply via email to