YARN-5588. [Partial backport] [YARN-3926] Add support for resource profiles in distributed shell. Contributed by Varun Vasudev.

(cherry picked from commit 7805deed4896e470ebd2f6bbd1ba9962947c63cd)
This commit is contained in:
Sunil G 2017-02-27 21:44:14 +05:30 committed by Daniel Templeton
parent a9fa0349a0
commit 4045ef047d
2 changed files with 10 additions and 4 deletions

View File

@ -532,7 +532,7 @@ private void verifyMatches(
List<? extends Collection<ContainerRequest>> matches,
int matchSize) {
assertEquals(1, matches.size());
assertEquals(matches.get(0).size(), matchSize);
assertEquals(matchSize, matches.get(0).size());
}
@Test (timeout=60000)

View File

@ -219,9 +219,15 @@ public Resource getMaxAllowedAllocation() {
return configuredMaxAllocation;
}
return Resources.createResource(
Math.min(configuredMaxAllocation.getMemorySize(), maxNodeMemory),
Math.min(configuredMaxAllocation.getVirtualCores(), maxNodeVCores));
Resource ret = Resources.clone(configuredMaxAllocation);
if (ret.getMemorySize() > maxNodeMemory) {
ret.setMemorySize(maxNodeMemory);
}
if (ret.getVirtualCores() > maxNodeVCores) {
ret.setVirtualCores(maxNodeVCores);
}
return ret;
} finally {
readLock.unlock();
}