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

(cherry picked from commit 7805deed48)
This commit is contained in:
Sunil G 2017-02-27 21:44:14 +05:30 committed by Jonathan Hung
parent 6db8c36ba9
commit c5e77e8b84
2 changed files with 10 additions and 4 deletions

View File

@ -546,7 +546,7 @@ public class TestAMRMClient {
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

@ -220,9 +220,15 @@ public class ClusterNodeTracker<N extends SchedulerNode> {
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();
}