YARN-7543. Add check for max cpu limit and missing file for YARN service.

(Contributed by Jian He)
This commit is contained in:
Eric Yang 2017-12-19 16:45:04 -05:00
parent c0aeb666a4
commit 989c75109a
2 changed files with 14 additions and 4 deletions

View File

@ -330,13 +330,19 @@ public class ServiceApiUtil {
org.apache.hadoop.yarn.api.records.Resource maxResource,
Service service) throws YarnException {
for (Component component : service.getComponents()) {
// only handle mem now.
long mem = Long.parseLong(component.getResource().getMemory());
if (mem > maxResource.getMemorySize()) {
throw new YarnException(
"Component " + component.getName() + " memory size (" + mem
+ ") is larger than configured max container memory size ("
+ maxResource.getMemorySize() + ")");
"Component " + component.getName() + ": specified memory size ("
+ mem + ") is larger than configured max container memory " +
"size (" + maxResource.getMemorySize() + ")");
}
int cpu = component.getResource().getCpus();
if (cpu > maxResource.getVirtualCores()) {
throw new YarnException(
"Component " + component.getName() + ": specified number of " +
"virtual core (" + cpu + ") is larger than configured max " +
"virtual core size (" + maxResource.getVirtualCores() + ")");
}
}
}

View File

@ -411,6 +411,10 @@ public final class ServiceUtils {
return;
}
for (File jarFile : listOfJars) {
if (!jarFile.exists()) {
log.debug("File does not exist, skipping: " + jarFile);
continue;
}
LocalResource res = sliderFileSystem.submitFile(jarFile, tempPath, libDir, jarFile.getName());
providerResources.put(libDir + "/" + jarFile.getName(), res);
}