Auto-created leaf queues do not honor cluster-wide settings for maximum CPU/vcores allocation.
- Set auto-create-child-queue.enabled=true for a parent queue.
- Set leaf-queue-template.maximum-allocation-mb=16384.
- Set yarn.resource-types.memory-mb.maximum-allocation=16384 in resource-types.xml
- Launch a YARN app with a container requesting 16 GB RAM.
This scenario should work, but instead you get an error similar to this:
This seems to be caused by this code in ManagedParentQueue.getLeafQueueConfigs:
This initializes a new leaf queue configuration that does not read resource-types.xml (or any other config). Later, this CapacitySchedulerConfiguration instance calls ResourceUtils.fetchMaximumAllocationFromConfig() from its getMaximumAllocationPerQueue() method and passes itself as the configuration to use. Since the resource types are not present, ResourceUtils falls back to compiled-in defaults of 8GB RAM, 4 cores.
I was able to work around this with a custom AutoCreatedQueueManagementPolicy implementation which does something like this in init() and reinitialize():
However, this is obviously a very hacky way to solve the problem.
I can submit a proper patch if someone can provide some direction as to the best way to proceed.