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 resourceCapability =
Resource.newInstance(containerMemory, containerVirtualCores); Resource.newInstance(containerMemory, containerVirtualCores);
if (resourceProfiles == null) { containerMemory =
containerMemory = containerMemory == -1 ? DEFAULT_CONTAINER_MEMORY : containerMemory == -1 ? DEFAULT_CONTAINER_MEMORY : containerMemory;
containerMemory; containerVirtualCores = containerVirtualCores == -1 ?
containerVirtualCores = DEFAULT_CONTAINER_VCORES :
containerVirtualCores == -1 ? DEFAULT_CONTAINER_VCORES : containerVirtualCores;
containerVirtualCores; resourceCapability.setMemorySize(containerMemory);
resourceCapability.setMemorySize(containerMemory); resourceCapability.setVirtualCores(containerVirtualCores);
resourceCapability.setVirtualCores(containerVirtualCores); for (Map.Entry<String, Long> entry : containerResources.entrySet()) {
for (Map.Entry<String, Long> entry : containerResources.entrySet()) { resourceCapability.setResourceValue(entry.getKey(), entry.getValue());
resourceCapability.setResourceValue(entry.getKey(), entry.getValue());
}
} }
String profileName = containerResourceProfile; String profileName = containerResourceProfile;