|
@@ -39,6 +39,7 @@ import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
import java.lang.reflect.Method;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.Collections;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
@@ -67,6 +68,12 @@ public class ResourcePluginManager {
|
|
|
Map<String, ResourcePlugin> pluginMap = new HashMap<>();
|
|
|
|
|
|
String[] plugins = conf.getStrings(YarnConfiguration.NM_RESOURCE_PLUGINS);
|
|
|
+ if (plugins == null || plugins.length == 0) {
|
|
|
+ LOG.info("No Resource plugins found from configuration!");
|
|
|
+ }
|
|
|
+ LOG.info("Found Resource plugins from configuration: "
|
|
|
+ + Arrays.toString(plugins));
|
|
|
+
|
|
|
if (plugins != null) {
|
|
|
// Initialize each plugins
|
|
|
for (String resourceName : plugins) {
|
|
@@ -75,23 +82,21 @@ public class ResourcePluginManager {
|
|
|
String msg =
|
|
|
"Trying to initialize resource plugin with name=" + resourceName
|
|
|
+ ", it is not supported, list of supported plugins:"
|
|
|
- + StringUtils.join(",",
|
|
|
- SUPPORTED_RESOURCE_PLUGINS);
|
|
|
+ + StringUtils.join(",", SUPPORTED_RESOURCE_PLUGINS);
|
|
|
LOG.error(msg);
|
|
|
throw new YarnException(msg);
|
|
|
}
|
|
|
|
|
|
if (pluginMap.containsKey(resourceName)) {
|
|
|
- // Duplicated items, ignore ...
|
|
|
+ LOG.warn("Ignoring duplicate Resource plugin definition: " +
|
|
|
+ resourceName);
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
ResourcePlugin plugin = null;
|
|
|
if (resourceName.equals(GPU_URI)) {
|
|
|
plugin = new GpuResourcePlugin();
|
|
|
- }
|
|
|
-
|
|
|
- if (resourceName.equals(FPGA_URI)) {
|
|
|
+ } else if (resourceName.equals(FPGA_URI)) {
|
|
|
plugin = new FpgaResourcePlugin();
|
|
|
}
|
|
|
|
|
@@ -101,6 +106,7 @@ public class ResourcePluginManager {
|
|
|
+ " should be loaded and initialized");
|
|
|
}
|
|
|
plugin.initialize(context);
|
|
|
+ LOG.info("Initialized plugin {}", plugin);
|
|
|
pluginMap.put(resourceName, plugin);
|
|
|
}
|
|
|
}
|