YARN-11646. Do not ignore zero memory capacity config in QueueCapacityConfigParser. ()

This commit is contained in:
Tamas Domok 2024-01-11 13:47:00 +01:00 committed by GitHub
parent bc159b5a87
commit 55b9f87698
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 6 deletions
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src
main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/conf
test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/conf

@ -148,11 +148,6 @@ public class QueueCapacityConfigParser {
}
}
// Memory always have to be defined
if (capacityVector.getMemory() == 0L) {
return new QueueCapacityVector();
}
return capacityVector;
}

@ -214,4 +214,19 @@ public class TestQueueCapacityConfigParser {
Lists.newArrayList(nonSetCapacity.iterator());
Assert.assertEquals(nonSetResources.size(), 0);
}
}
@Test
public void testZeroAbsoluteCapacityConfig() {
QueueCapacityVector weightCapacityVector =
capacityConfigParser.parse(String.format(MEMORY_VCORE_TEMPLATE, 0, 0), QUEUE);
QueueCapacityVectorEntry memory = weightCapacityVector.getResource(MEMORY_URI);
QueueCapacityVectorEntry vcore = weightCapacityVector.getResource(VCORES_URI);
Assert.assertEquals(ResourceUnitCapacityType.ABSOLUTE, memory.getVectorResourceType());
Assert.assertEquals(0, memory.getResourceValue(), EPSILON);
Assert.assertEquals(ResourceUnitCapacityType.ABSOLUTE, vcore.getVectorResourceType());
Assert.assertEquals(0, vcore.getResourceValue(), EPSILON);
}
}