Skip to content

Commit c458182

Browse files
committed
YARN-10691. DominantResourceCalculator isInvalidDivisor should consider only countable resource types. Contributed by Bilwa S T.
1 parent b86a6eb commit c458182

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/resource/DominantResourceCalculator.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,9 @@ public float divide(Resource clusterResource,
380380

381381
@Override
382382
public boolean isInvalidDivisor(Resource r) {
383-
for (ResourceInformation res : r.getResources()) {
384-
if (res.getValue() == 0L) {
383+
int maxLength = ResourceUtils.getNumberOfCountableResourceTypes();
384+
for (int i = 0; i < maxLength; i++) {
385+
if (r.getResourceInformation(i).getValue() == 0L) {
385386
return true;
386387
}
387388
}

0 commit comments

Comments
 (0)