Thank you very much, Wangda Tan!
1) The ultimate solution seems to be
YARN-3362. Have you evaluated how hard to back port it?
My intent with this JIRA was simply to provide accurate visual feedback on the Capacity Scheduler Application Queues page for resources used by labeled queues. I will look deeper into what it would take to backport
YARN-3362. My concern is that it would include more risk and features than we really want to backport into 2.7.
2) If you don't want to backport
YARN-3362. IIUC, the computation of total-used-capacity-considers-all-labels seems wrong:
In your patch it is Σ(queue.label.used_capacity), actually it should be Σ(queue.label.used_resource) / S(root.label.total_resource)
I think you are talking about getAllUsedCapacityConsideringLabels. IIUC, in this patch, used capacity is calculated correctly by CSQueueUtils#updateQueueStatistics when it is called by LeafQueue to allocate resources. updateQueueStatistics calls AbstractCSQueue#getAllUsedResourcesConsideringLabels to retrieve all resources consumed by the queue, including labeled resources. It then divides the consumed resources by the queue's limit:
public static void updateQueueStatistics(
Resource usedResources = childQueue.getAllUsedResourcesConsideringLabels();
Resources.equals(queueLimit, Resources.none()) ? 0 :
Even still, this patch is, perhaps, not ideal. When used capacity, absolute used capacity, and available resources are set, these metrics are associated with NO_LABEL. So, although the metrics reflect all used resources for a queue (even at parent levels), they are not set per label but just gathered in with NO_LABEL. In order to associate the resources with a label, I think the interface to CSQueueUtils#updateQueueStatistics may need to change.
Let me get a more precise view of what it would take to backport