YARN-5994. TestCapacityScheduler.testAMLimitUsage fails intermittently. Contributed by Eric Badger
(cherry-picked from commit a41f8dd58e27d8835fbb64eeaba5d7416df0499d)
This commit is contained in:
parent
5756256280
commit
157a9f3104
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
package org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity;
|
package org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity;
|
||||||
|
|
||||||
|
import com.google.common.base.Supplier;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
@ -29,6 +30,7 @@
|
|||||||
import org.apache.hadoop.security.UserGroupInformation;
|
import org.apache.hadoop.security.UserGroupInformation;
|
||||||
import org.apache.hadoop.security.token.Token;
|
import org.apache.hadoop.security.token.Token;
|
||||||
import org.apache.hadoop.security.token.TokenIdentifier;
|
import org.apache.hadoop.security.token.TokenIdentifier;
|
||||||
|
import org.apache.hadoop.test.GenericTestUtils;
|
||||||
import org.apache.hadoop.yarn.LocalConfigurationProvider;
|
import org.apache.hadoop.yarn.LocalConfigurationProvider;
|
||||||
import org.apache.hadoop.yarn.api.ApplicationMasterProtocol;
|
import org.apache.hadoop.yarn.api.ApplicationMasterProtocol;
|
||||||
import org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest;
|
import org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest;
|
||||||
@ -3465,7 +3467,7 @@ public void testDefaultNodeLabelExpressionQueueConfig() throws Exception {
|
|||||||
Assert.assertEquals(queueInfoB.getDefaultNodeLabelExpression(), "y");
|
Assert.assertEquals(queueInfoB.getDefaultNodeLabelExpression(), "y");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(timeout = 30000)
|
@Test(timeout = 60000)
|
||||||
public void testAMLimitUsage() throws Exception {
|
public void testAMLimitUsage() throws Exception {
|
||||||
|
|
||||||
CapacitySchedulerConfiguration config =
|
CapacitySchedulerConfiguration config =
|
||||||
@ -3593,11 +3595,12 @@ protected RMNodeLabelsManager createNodeLabelManager() {
|
|||||||
private void verifyAMLimitForLeafQueue(CapacitySchedulerConfiguration config)
|
private void verifyAMLimitForLeafQueue(CapacitySchedulerConfiguration config)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
MockRM rm = setUpMove(config);
|
MockRM rm = setUpMove(config);
|
||||||
rm.registerNode("127.0.0.1:1234", 2 * GB);
|
final int nodeMemory = 4 * GB;
|
||||||
|
rm.registerNode("127.0.0.1:1234", nodeMemory);
|
||||||
|
|
||||||
String queueName = "a1";
|
String queueName = "a1";
|
||||||
String userName = "user_0";
|
String userName = "user_0";
|
||||||
ResourceScheduler scheduler = rm.getRMContext().getScheduler();
|
final ResourceScheduler scheduler = rm.getRMContext().getScheduler();
|
||||||
LeafQueue queueA =
|
LeafQueue queueA =
|
||||||
(LeafQueue) ((CapacityScheduler) scheduler).getQueue(queueName);
|
(LeafQueue) ((CapacityScheduler) scheduler).getQueue(queueName);
|
||||||
Resource amResourceLimit = queueA.getAMResourceLimit();
|
Resource amResourceLimit = queueA.getAMResourceLimit();
|
||||||
@ -3609,6 +3612,14 @@ private void verifyAMLimitForLeafQueue(CapacitySchedulerConfiguration config)
|
|||||||
Resource.newInstance(amResourceLimit.getMemorySize() + 2048,
|
Resource.newInstance(amResourceLimit.getMemorySize() + 2048,
|
||||||
amResourceLimit.getVirtualCores() + 1);
|
amResourceLimit.getVirtualCores() + 1);
|
||||||
|
|
||||||
|
// Wait for the scheduler to be updated with new node capacity
|
||||||
|
GenericTestUtils.waitFor(new Supplier<Boolean>() {
|
||||||
|
@Override
|
||||||
|
public Boolean get() {
|
||||||
|
return scheduler.getMaximumResourceCapability().getMemorySize() == nodeMemory;
|
||||||
|
}
|
||||||
|
}, 100, 60 * 1000);
|
||||||
|
|
||||||
rm.submitApp(amResource1, "app-1", userName, null, queueName);
|
rm.submitApp(amResource1, "app-1", userName, null, queueName);
|
||||||
|
|
||||||
rm.submitApp(amResource2, "app-2", userName, null, queueName);
|
rm.submitApp(amResource2, "app-2", userName, null, queueName);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user