Index: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/AbstractYarnScheduler.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/AbstractYarnScheduler.java (date 1509036279000) +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/AbstractYarnScheduler.java (date 1509578000000) @@ -1351,8 +1351,8 @@ @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 Index: 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 IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- 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 (date 1509036279000) +++ 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 (date 1509578000000) @@ -2591,7 +2591,7 @@ 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; Index: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/TestApplicationLifetimeMonitor.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/TestApplicationLifetimeMonitor.java (date 1509036279000) +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/TestApplicationLifetimeMonitor.java (date 1509578000000) @@ -30,6 +30,7 @@ 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 @@ */ @RunWith(Parameterized.class) public class TestApplicationLifetimeMonitor { + private final long maxLifetime = 30L; + private YarnConfiguration conf; @Parameterized.Parameters @@ -90,7 +93,16 @@ @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 @@ 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();