addendum patch for YARN-7289.

This commit is contained in:
Rohith Sharma K S 2017-11-02 13:55:19 +05:30
parent 0cc98ae0ec
commit 940ffe3f9c
3 changed files with 16 additions and 14 deletions

View File

@ -1351,8 +1351,8 @@ public Resource getMaximumAllocation() {
@Override @Override
public long checkAndGetApplicationLifetime(String queueName, long lifetime) { public long checkAndGetApplicationLifetime(String queueName, long lifetime) {
// -1 indicates, lifetime is not configured. // Lifetime is the application lifetime by default.
return -1; return lifetime;
} }
@Override @Override

View File

@ -2591,7 +2591,7 @@ public long checkAndGetApplicationLifetime(String queueName,
long maximumApplicationLifetime = long maximumApplicationLifetime =
((LeafQueue) queue).getMaximumApplicationLifetime(); ((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 // exceed maximum
if (maximumApplicationLifetime <= 0) { if (maximumApplicationLifetime <= 0) {
return lifetimeRequestedByApp; return lifetimeRequestedByApp;

View File

@ -30,6 +30,7 @@
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest; import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest;
import org.apache.hadoop.yarn.api.protocolrecords.UpdateApplicationTimeoutsRequest; import org.apache.hadoop.yarn.api.protocolrecords.UpdateApplicationTimeoutsRequest;
@ -72,6 +73,8 @@
*/ */
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class TestApplicationLifetimeMonitor { public class TestApplicationLifetimeMonitor {
private final long maxLifetime = 30L;
private YarnConfiguration conf; private YarnConfiguration conf;
@Parameterized.Parameters @Parameterized.Parameters
@ -90,7 +93,16 @@ public TestApplicationLifetimeMonitor(Class schedulerParameter) {
@Before @Before
public void setup() throws IOException { public void setup() throws IOException {
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(); conf = new YarnConfiguration();
}
// Always run for CS, since other scheduler do not support this. // Always run for CS, since other scheduler do not support this.
conf.setClass(YarnConfiguration.RM_SCHEDULER, conf.setClass(YarnConfiguration.RM_SCHEDULER,
scheduler, ResourceScheduler.class); scheduler, ResourceScheduler.class);
@ -106,16 +118,6 @@ public void testApplicationLifetimeMonitor()
throws Exception { throws Exception {
MockRM rm = null; MockRM rm = null;
try { 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 = new MockRM(conf);
rm.start(); rm.start();