YARN-7543. Add check for max cpu limit and missing file for YARN service.
(Contributed by Jian He)
This commit is contained in:
parent
c0aeb666a4
commit
989c75109a
|
@ -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() + ")");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue