YARN-7718. DistributedShell failed to specify resource other than memory/vcores from container_resources. Contributed by Wangda Tan.

This commit is contained in:
Sunil G 2018-01-09 16:39:33 +05:30
parent b3290c41a9
commit 783a01eb4a
1 changed files with 9 additions and 11 deletions

View File

@ -1602,17 +1602,15 @@ public class ApplicationMaster {
Resource resourceCapability =
Resource.newInstance(containerMemory, containerVirtualCores);
if (resourceProfiles == null) {
containerMemory = containerMemory == -1 ? DEFAULT_CONTAINER_MEMORY :
containerMemory;
containerVirtualCores =
containerVirtualCores == -1 ? DEFAULT_CONTAINER_VCORES :
containerVirtualCores;
resourceCapability.setMemorySize(containerMemory);
resourceCapability.setVirtualCores(containerVirtualCores);
for (Map.Entry<String, Long> entry : containerResources.entrySet()) {
resourceCapability.setResourceValue(entry.getKey(), entry.getValue());
}
containerMemory =
containerMemory == -1 ? DEFAULT_CONTAINER_MEMORY : containerMemory;
containerVirtualCores = containerVirtualCores == -1 ?
DEFAULT_CONTAINER_VCORES :
containerVirtualCores;
resourceCapability.setMemorySize(containerMemory);
resourceCapability.setVirtualCores(containerVirtualCores);
for (Map.Entry<String, Long> entry : containerResources.entrySet()) {
resourceCapability.setResourceValue(entry.getKey(), entry.getValue());
}
String profileName = containerResourceProfile;