YARN-9790. Failed to set default-application-lifetime if maximum-application-lifetime is less than or equal to zero. Contributed by kyungwan nam.
(cherry picked from commit d2d963f3d4
)
This commit is contained in:
parent
9638985428
commit
868a0f5ef0
|
@ -3078,7 +3078,8 @@ public class CapacityScheduler extends
|
||||||
// check only for maximum, that's enough because default can'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 <= 0) ? defaultApplicationLifetime :
|
||||||
|
lifetimeRequestedByApp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lifetimeRequestedByApp <= 0) {
|
if (lifetimeRequestedByApp <= 0) {
|
||||||
|
|
|
@ -265,7 +265,8 @@ public class LeafQueue extends AbstractCSQueue {
|
||||||
conf.getMaximumLifetimePerQueue((getQueuePath()));
|
conf.getMaximumLifetimePerQueue((getQueuePath()));
|
||||||
defaultApplicationLifetime =
|
defaultApplicationLifetime =
|
||||||
conf.getDefaultLifetimePerQueue((getQueuePath()));
|
conf.getDefaultLifetimePerQueue((getQueuePath()));
|
||||||
if (defaultApplicationLifetime > maxApplicationLifetime) {
|
if (maxApplicationLifetime > 0 &&
|
||||||
|
defaultApplicationLifetime > maxApplicationLifetime) {
|
||||||
throw new YarnRuntimeException(
|
throw new YarnRuntimeException(
|
||||||
"Default lifetime" + defaultApplicationLifetime
|
"Default lifetime" + defaultApplicationLifetime
|
||||||
+ " can't exceed maximum lifetime " + maxApplicationLifetime);
|
+ " can't exceed maximum lifetime " + maxApplicationLifetime);
|
||||||
|
|
|
@ -4854,7 +4854,8 @@ public class TestCapacityScheduler extends CapacitySchedulerTestBase {
|
||||||
Assert.assertEquals(100, cs.checkAndGetApplicationLifetime("default", 100));
|
Assert.assertEquals(100, cs.checkAndGetApplicationLifetime("default", 100));
|
||||||
Assert.assertEquals(defaultLifetime,
|
Assert.assertEquals(defaultLifetime,
|
||||||
cs.checkAndGetApplicationLifetime("default", -1));
|
cs.checkAndGetApplicationLifetime("default", -1));
|
||||||
Assert.assertEquals(0, cs.checkAndGetApplicationLifetime("default", 0));
|
Assert.assertEquals(defaultLifetime,
|
||||||
|
cs.checkAndGetApplicationLifetime("default", 0));
|
||||||
Assert.assertEquals(maxLifetime,
|
Assert.assertEquals(maxLifetime,
|
||||||
cs.getMaximumApplicationLifetime("default"));
|
cs.getMaximumApplicationLifetime("default"));
|
||||||
|
|
||||||
|
@ -4874,8 +4875,10 @@ public class TestCapacityScheduler extends CapacitySchedulerTestBase {
|
||||||
defaultLifetime = 0;
|
defaultLifetime = 0;
|
||||||
cs = setUpCSQueue(maxLifetime, defaultLifetime);
|
cs = setUpCSQueue(maxLifetime, defaultLifetime);
|
||||||
Assert.assertEquals(100, cs.checkAndGetApplicationLifetime("default", 100));
|
Assert.assertEquals(100, cs.checkAndGetApplicationLifetime("default", 100));
|
||||||
Assert.assertEquals(-1, cs.checkAndGetApplicationLifetime("default", -1));
|
Assert.assertEquals(defaultLifetime,
|
||||||
Assert.assertEquals(0, cs.checkAndGetApplicationLifetime("default", 0));
|
cs.checkAndGetApplicationLifetime("default", -1));
|
||||||
|
Assert.assertEquals(defaultLifetime,
|
||||||
|
cs.checkAndGetApplicationLifetime("default", 0));
|
||||||
|
|
||||||
maxLifetime = 10;
|
maxLifetime = 10;
|
||||||
defaultLifetime = -1;
|
defaultLifetime = -1;
|
||||||
|
@ -4896,6 +4899,16 @@ public class TestCapacityScheduler extends CapacitySchedulerTestBase {
|
||||||
Assert.assertTrue(
|
Assert.assertTrue(
|
||||||
ye.getMessage().contains("can't exceed maximum lifetime"));
|
ye.getMessage().contains("can't exceed maximum lifetime"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
maxLifetime = -1;
|
||||||
|
defaultLifetime = 10;
|
||||||
|
cs = setUpCSQueue(maxLifetime, defaultLifetime);
|
||||||
|
Assert.assertEquals(100,
|
||||||
|
cs.checkAndGetApplicationLifetime("default", 100));
|
||||||
|
Assert.assertEquals(defaultLifetime,
|
||||||
|
cs.checkAndGetApplicationLifetime("default", -1));
|
||||||
|
Assert.assertEquals(defaultLifetime,
|
||||||
|
cs.checkAndGetApplicationLifetime("default", 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
private CapacityScheduler setUpCSQueue(long maxLifetime,
|
private CapacityScheduler setUpCSQueue(long maxLifetime,
|
||||||
|
|
Loading…
Reference in New Issue