YARN-10801. Fix Auto Queue template to properly set all configuration properties. Contributed by Andras Gyori
This commit is contained in:
parent
2b304ad645
commit
428478bbe2
@ -360,9 +360,8 @@ protected void setupQueueConfigs(Resource clusterResource,
|
|||||||
|
|
||||||
writeLock.lock();
|
writeLock.lock();
|
||||||
try {
|
try {
|
||||||
if (isDynamicQueue() && getParent() instanceof ParentQueue) {
|
if (isDynamicQueue()) {
|
||||||
((ParentQueue) getParent()).getAutoCreatedQueueTemplate()
|
setDynamicQueueProperties(configuration);
|
||||||
.setTemplateEntriesForChild(configuration, getQueuePath());
|
|
||||||
}
|
}
|
||||||
// get labels
|
// get labels
|
||||||
this.accessibleLabels =
|
this.accessibleLabels =
|
||||||
@ -478,6 +477,19 @@ protected void setupQueueConfigs(Resource clusterResource,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set properties specific to dynamic queues.
|
||||||
|
* @param configuration configuration on which the properties are set
|
||||||
|
*/
|
||||||
|
protected void setDynamicQueueProperties(
|
||||||
|
CapacitySchedulerConfiguration configuration) {
|
||||||
|
// Set properties from parent template
|
||||||
|
if (getParent() instanceof ParentQueue) {
|
||||||
|
((ParentQueue) getParent()).getAutoCreatedQueueTemplate()
|
||||||
|
.setTemplateEntriesForChild(configuration, getQueuePath());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void setupMaximumAllocation(CapacitySchedulerConfiguration csConf) {
|
private void setupMaximumAllocation(CapacitySchedulerConfiguration csConf) {
|
||||||
String myQueuePath = getQueuePath();
|
String myQueuePath = getQueuePath();
|
||||||
Resource clusterMax = ResourceUtils
|
Resource clusterMax = ResourceUtils
|
||||||
|
@ -147,14 +147,21 @@ public class LeafQueue extends AbstractCSQueue {
|
|||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
public LeafQueue(CapacitySchedulerContext cs,
|
public LeafQueue(CapacitySchedulerContext cs,
|
||||||
String queueName, CSQueue parent, CSQueue old) throws IOException {
|
String queueName, CSQueue parent, CSQueue old) throws IOException {
|
||||||
this(cs, cs.getConfiguration(), queueName, parent, old);
|
this(cs, cs.getConfiguration(), queueName, parent, old, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LeafQueue(CapacitySchedulerContext cs,
|
public LeafQueue(CapacitySchedulerContext cs,
|
||||||
CapacitySchedulerConfiguration configuration,
|
CapacitySchedulerConfiguration configuration,
|
||||||
String queueName, CSQueue parent, CSQueue old) throws
|
String queueName, CSQueue parent, CSQueue old) throws IOException {
|
||||||
|
this(cs, configuration, queueName, parent, old, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LeafQueue(CapacitySchedulerContext cs,
|
||||||
|
CapacitySchedulerConfiguration configuration,
|
||||||
|
String queueName, CSQueue parent, CSQueue old, boolean isDynamic) throws
|
||||||
IOException {
|
IOException {
|
||||||
super(cs, configuration, queueName, parent, old);
|
super(cs, configuration, queueName, parent, old);
|
||||||
|
setDynamicQueue(isDynamic);
|
||||||
this.scheduler = cs;
|
this.scheduler = cs;
|
||||||
|
|
||||||
this.usersManager = new UsersManager(metrics, this, labelManager, scheduler,
|
this.usersManager = new UsersManager(metrics, this, labelManager, scheduler,
|
||||||
@ -1691,6 +1698,17 @@ protected boolean canAssignToUser(Resource clusterResource,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setDynamicQueueProperties(
|
||||||
|
CapacitySchedulerConfiguration configuration) {
|
||||||
|
super.setDynamicQueueProperties(configuration);
|
||||||
|
// set to -1, to disable it
|
||||||
|
configuration.setUserLimitFactor(getQueuePath(), -1);
|
||||||
|
// Set Max AM percentage to a higher value
|
||||||
|
configuration.setMaximumApplicationMasterResourcePerQueuePercent(
|
||||||
|
getQueuePath(), 1f);
|
||||||
|
}
|
||||||
|
|
||||||
private void updateSchedulerHealthForCompletedContainer(
|
private void updateSchedulerHealthForCompletedContainer(
|
||||||
RMContainer rmContainer, ContainerStatus containerStatus) {
|
RMContainer rmContainer, ContainerStatus containerStatus) {
|
||||||
// Update SchedulerHealth for released / preempted container
|
// Update SchedulerHealth for released / preempted container
|
||||||
|
@ -112,14 +112,21 @@ public class ParentQueue extends AbstractCSQueue {
|
|||||||
|
|
||||||
public ParentQueue(CapacitySchedulerContext cs,
|
public ParentQueue(CapacitySchedulerContext cs,
|
||||||
String queueName, CSQueue parent, CSQueue old) throws IOException {
|
String queueName, CSQueue parent, CSQueue old) throws IOException {
|
||||||
this(cs, cs.getConfiguration(), queueName, parent, old);
|
this(cs, cs.getConfiguration(), queueName, parent, old, false);
|
||||||
|
}
|
||||||
|
private ParentQueue(CapacitySchedulerContext cs,
|
||||||
|
CapacitySchedulerConfiguration csConf, String queueName,
|
||||||
|
CSQueue parent,
|
||||||
|
CSQueue old) throws IOException {
|
||||||
|
this(cs, csConf, queueName, parent, old, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ParentQueue(CapacitySchedulerContext cs,
|
private ParentQueue(CapacitySchedulerContext cs,
|
||||||
CapacitySchedulerConfiguration csConf, String queueName, CSQueue parent,
|
CapacitySchedulerConfiguration csConf, String queueName, CSQueue parent,
|
||||||
CSQueue old)
|
CSQueue old, boolean isDynamic)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
super(cs, queueName, parent, old);
|
super(cs, queueName, parent, old);
|
||||||
|
setDynamicQueue(isDynamic);
|
||||||
this.scheduler = cs;
|
this.scheduler = cs;
|
||||||
this.rootQueue = (parent == null);
|
this.rootQueue = (parent == null);
|
||||||
|
|
||||||
@ -476,26 +483,6 @@ public String toString() {
|
|||||||
"numContainers=" + getNumContainers();
|
"numContainers=" + getNumContainers();
|
||||||
}
|
}
|
||||||
|
|
||||||
private CapacitySchedulerConfiguration getConfForAutoCreatedQueue(
|
|
||||||
String childQueuePath, boolean isLeaf) {
|
|
||||||
// Copy existing config
|
|
||||||
CapacitySchedulerConfiguration dupCSConfig =
|
|
||||||
new CapacitySchedulerConfiguration(
|
|
||||||
csContext.getConfiguration(), false);
|
|
||||||
autoCreatedQueueTemplate.setTemplateEntriesForChild(dupCSConfig,
|
|
||||||
childQueuePath);
|
|
||||||
if (isLeaf) {
|
|
||||||
// set to -1, to disable it
|
|
||||||
dupCSConfig.setUserLimitFactor(childQueuePath, -1);
|
|
||||||
|
|
||||||
// Set Max AM percentage to a higher value
|
|
||||||
dupCSConfig.setMaximumApplicationMasterResourcePerQueuePercent(
|
|
||||||
childQueuePath, 0.5f);
|
|
||||||
}
|
|
||||||
|
|
||||||
return dupCSConfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
private CSQueue createNewQueue(String childQueuePath, boolean isLeaf)
|
private CSQueue createNewQueue(String childQueuePath, boolean isLeaf)
|
||||||
throws SchedulerDynamicEditException {
|
throws SchedulerDynamicEditException {
|
||||||
try {
|
try {
|
||||||
@ -504,13 +491,11 @@ private CSQueue createNewQueue(String childQueuePath, boolean isLeaf)
|
|||||||
childQueuePath.lastIndexOf(".") + 1);
|
childQueuePath.lastIndexOf(".") + 1);
|
||||||
|
|
||||||
if (isLeaf) {
|
if (isLeaf) {
|
||||||
childQueue = new LeafQueue(csContext,
|
childQueue = new LeafQueue(csContext, csContext.getConfiguration(),
|
||||||
getConfForAutoCreatedQueue(childQueuePath, isLeaf), queueShortName,
|
queueShortName, this, null, true);
|
||||||
this, null);
|
|
||||||
} else{
|
} else{
|
||||||
childQueue = new ParentQueue(csContext,
|
childQueue = new ParentQueue(csContext, csContext.getConfiguration(),
|
||||||
getConfForAutoCreatedQueue(childQueuePath, isLeaf), queueShortName,
|
queueShortName, this, null, true);
|
||||||
this, null);
|
|
||||||
}
|
}
|
||||||
childQueue.setDynamicQueue(true);
|
childQueue.setDynamicQueue(true);
|
||||||
// It should be sufficient now, we don't need to set more, because weights
|
// It should be sufficient now, we don't need to set more, because weights
|
||||||
|
@ -147,6 +147,8 @@ private void createBasicQueueStructureAndValidate() throws Exception {
|
|||||||
Assert.assertEquals(1f, c.getQueueCapacities().getWeight(), 1e-6);
|
Assert.assertEquals(1f, c.getQueueCapacities().getWeight(), 1e-6);
|
||||||
Assert.assertEquals(400 * GB,
|
Assert.assertEquals(400 * GB,
|
||||||
c.getQueueResourceQuotas().getEffectiveMinResource().getMemorySize());
|
c.getQueueResourceQuotas().getEffectiveMinResource().getMemorySize());
|
||||||
|
Assert.assertEquals(((LeafQueue)c).getUserLimitFactor(), -1, 1e-6);
|
||||||
|
Assert.assertEquals(((LeafQueue)c).getMaxAMResourcePerQueuePercent(), 1, 1e-6);
|
||||||
|
|
||||||
// Now add another queue-d, in the same hierarchy
|
// Now add another queue-d, in the same hierarchy
|
||||||
createQueue("root.d-auto");
|
createQueue("root.d-auto");
|
||||||
@ -696,6 +698,14 @@ public void testAutoCreatedQueueTemplateConfig() throws Exception {
|
|||||||
cs.reinitialize(csConf, mockRM.getRMContext());
|
cs.reinitialize(csConf, mockRM.getRMContext());
|
||||||
Assert.assertEquals("weight is not explicitly set", 4f,
|
Assert.assertEquals("weight is not explicitly set", 4f,
|
||||||
a2.getQueueCapacities().getWeight(), 1e-6);
|
a2.getQueueCapacities().getWeight(), 1e-6);
|
||||||
|
|
||||||
|
csConf.setBoolean(AutoCreatedQueueTemplate.getAutoQueueTemplatePrefix(
|
||||||
|
"root.a") + CapacitySchedulerConfiguration
|
||||||
|
.AUTO_CREATE_CHILD_QUEUE_AUTO_REMOVAL_ENABLE, false);
|
||||||
|
cs.reinitialize(csConf, mockRM.getRMContext());
|
||||||
|
LeafQueue a3 = createQueue("root.a.a3");
|
||||||
|
Assert.assertFalse("auto queue deletion should be turned off on a3",
|
||||||
|
a3.isEligibleForAutoDeletion());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
x
Reference in New Issue
Block a user