YARN-10691. DominantResourceCalculator isInvalidDivisor should consider only countable resource types. Contributed by Bilwa S T.

This commit is contained in:
Jim Brennan 2021-05-25 18:07:28 +00:00
parent b86a6eb871
commit c4581827a9

View File

@ -380,8 +380,9 @@ public float divide(Resource clusterResource,
@Override
public boolean isInvalidDivisor(Resource r) {
for (ResourceInformation res : r.getResources()) {
if (res.getValue() == 0L) {
int maxLength = ResourceUtils.getNumberOfCountableResourceTypes();
for (int i = 0; i < maxLength; i++) {
if (r.getResourceInformation(i).getValue() == 0L) {
return true;
}
}