diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/OptionKeys.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/OptionKeys.java index 434b1d993f..988627df94 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/OptionKeys.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/OptionKeys.java @@ -53,8 +53,22 @@ public interface OptionKeys extends InternalKeys { * Prefix for export options: {@value} */ String EXPORT_PREFIX = "export."; + /** + * Type suffix for config file and package options: {@value} + */ String TYPE_SUFFIX = ".type"; + /** + * Name suffix for config file and package options: {@value} + */ String NAME_SUFFIX = ".name"; + /** + * Per component suffix for config file options: {@value} + */ + String PER_COMPONENT = ".per.component"; + /** + * Per group suffix for config file options: {@value} + */ + String PER_GROUP = ".per.group"; /** * Zookeeper quorum host list: {@value} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/SliderKeys.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/SliderKeys.java index 3d25d331db..adf40ce485 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/SliderKeys.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/SliderKeys.java @@ -304,8 +304,6 @@ public interface SliderKeys extends SliderXmlConfKeys { String APP_RESOURCES = "application.resources"; String APP_RESOURCES_DIR = "app/resources"; - String PER_COMPONENT = "per.component"; - String PER_GROUP = "per.group"; String APP_PACKAGES_DIR = "app/packages"; } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/ProviderUtils.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/ProviderUtils.java index 39986c1203..bc237f5da2 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/ProviderUtils.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/ProviderUtils.java @@ -614,8 +614,16 @@ public void localizeConfigFiles(ContainerLauncher launcher, throw new BadConfigException("Config format " + configFileType + " doesn't exist"); } + boolean perComponent = appConf.getComponentOptBool(roleGroup, + OptionKeys.CONF_FILE_PREFIX + configEntry.getKey() + OptionKeys + .PER_COMPONENT, false); + boolean perGroup = appConf.getComponentOptBool(roleGroup, + OptionKeys.CONF_FILE_PREFIX + configEntry.getKey() + OptionKeys + .PER_GROUP, false); + localizeConfigFile(launcher, roleName, roleGroup, configEntry.getKey(), - configFormat, configFileName, configs, env, fileSystem, clusterName); + configFormat, configFileName, configs, env, fileSystem, + clusterName, perComponent, perGroup); } } @@ -631,6 +639,8 @@ public void localizeConfigFiles(ContainerLauncher launcher, * @param env environment variables * @param fileSystem file system * @param clusterName app name + * @param perComponent true if file should be created per unique component + * @param perGroup true if file should be created per component group * @throws IOException file cannot be uploaded */ public void localizeConfigFile(ContainerLauncher launcher, @@ -639,7 +649,9 @@ public void localizeConfigFile(ContainerLauncher launcher, Map> configs, MapOperations env, SliderFileSystem fileSystem, - String clusterName) + String clusterName, + boolean perComponent, + boolean perGroup) throws IOException { if (launcher == null) { return; @@ -655,9 +667,9 @@ public void localizeConfigFile(ContainerLauncher launcher, } String folder = null; - if ("true".equals(config.get(PER_COMPONENT))) { + if (perComponent) { folder = roleName; - } else if ("true".equals(config.get(PER_GROUP))) { + } else if (perGroup) { folder = roleGroup; } if (folder != null) {