YARN-8923.  Cleanup references to ENV file type in YARN service code.
            Contributed by Suma Shivaprasad


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/e98a5062
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/e98a5062
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/e98a5062

Branch: refs/heads/HDFS-12943
Commit: e98a506227d68965337844aaafaeab6ad3ce1f60
Parents: c58811c
Author: Eric Yang <[email protected]>
Authored: Mon Oct 22 18:39:57 2018 -0400
Committer: Eric Yang <[email protected]>
Committed: Mon Oct 22 18:39:57 2018 -0400

----------------------------------------------------------------------
 .../yarn/service/api/records/ConfigFormat.java  |  5 +-
 .../hadoop/yarn/service/utils/ConfigUtils.java  | 56 --------------------
 .../service/utils/PublishedConfiguration.java   |  9 ----
 .../utils/PublishedConfigurationOutputter.java  |  2 -
 4 files changed, 2 insertions(+), 70 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/e98a5062/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/api/records/ConfigFormat.java
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/api/records/ConfigFormat.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/api/records/ConfigFormat.java
index e10305a..4e21ea0 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/api/records/ConfigFormat.java
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/api/records/ConfigFormat.java
@@ -31,10 +31,9 @@ public enum ConfigFormat {
   PROPERTIES("properties"),
   XML("xml"),
   HADOOP_XML("hadoop_xml"),
-  ENV("env"),
   TEMPLATE("template"),
-  YAML("yaml"),
-  ;
+  YAML("yaml");
+
   ConfigFormat(String suffix) {
     this.suffix = suffix;
   }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/e98a5062/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/utils/ConfigUtils.java
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/utils/ConfigUtils.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/utils/ConfigUtils.java
index a969be9..1bc7b08 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/utils/ConfigUtils.java
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/utils/ConfigUtils.java
@@ -17,11 +17,6 @@
  */
 package org.apache.hadoop.yarn.service.utils;
 
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.yarn.service.api.records.ConfigFormat;
-import org.apache.hadoop.yarn.service.utils.SliderFileSystem;
-
-import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Map.Entry;
@@ -29,7 +24,6 @@ import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 public class ConfigUtils {
-  public static final String TEMPLATE_FILE = "template.file";
 
   public static String replaceProps(Map<String, String> config, String 
content) {
     Map<String, String> tokens = new HashMap<>();
@@ -44,54 +38,4 @@ public class ConfigUtils {
     }
     return value;
   }
-
-  public static Map<String, String> replacePropsInConfig(
-      Map<String, String> config, Map<String, String> env) {
-    Map<String, String> tokens = new HashMap<>();
-    for (Entry<String, String> entry : env.entrySet()) {
-      tokens.put("${" + entry.getKey() + "}", entry.getValue());
-    }
-    Map<String, String> newConfig = new HashMap<>();
-    for (Entry<String, String> entry : config.entrySet()) {
-      String value = entry.getValue();
-      for (Map.Entry<String,String> token : tokens.entrySet()) {
-        value = value.replaceAll(Pattern.quote(token.getKey()),
-            Matcher.quoteReplacement(token.getValue()));
-      }
-      newConfig.put(entry.getKey(), entry.getValue());
-    }
-    return newConfig;
-  }
-
-  public static void prepConfigForTemplateOutputter(ConfigFormat configFormat,
-      Map<String, String> config, SliderFileSystem fileSystem,
-      String clusterName, String fileName) throws IOException {
-    if (!configFormat.equals(ConfigFormat.TEMPLATE)) {
-      return;
-    }
-    Path templateFile = null;
-    if (config.containsKey(TEMPLATE_FILE)) {
-      templateFile = fileSystem.buildResourcePath(config.get(TEMPLATE_FILE));
-      if (!fileSystem.isFile(templateFile)) {
-        templateFile = fileSystem.buildResourcePath(clusterName,
-            config.get(TEMPLATE_FILE));
-      }
-      if (!fileSystem.isFile(templateFile)) {
-        throw new IOException("config specified template file " + config
-            .get(TEMPLATE_FILE) + " but " + templateFile + " doesn't exist");
-      }
-    }
-    if (templateFile == null && fileName != null) {
-      templateFile = fileSystem.buildResourcePath(fileName);
-      if (!fileSystem.isFile(templateFile)) {
-        templateFile = fileSystem.buildResourcePath(clusterName,
-            fileName);
-      }
-    }
-    if (fileSystem.isFile(templateFile)) {
-      config.put("content", fileSystem.cat(templateFile));
-    } else {
-      config.put("content", "");
-    }
-  }
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/e98a5062/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/utils/PublishedConfiguration.java
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/utils/PublishedConfiguration.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/utils/PublishedConfiguration.java
index 9d00b3c..04fbe66 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/utils/PublishedConfiguration.java
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/utils/PublishedConfiguration.java
@@ -19,7 +19,6 @@
 package org.apache.hadoop.yarn.service.utils;
 
 import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.yarn.service.api.records.ConfigFormat;
 import org.apache.hadoop.yarn.service.exceptions.BadConfigException;
 import org.codehaus.jackson.annotate.JsonIgnoreProperties;
 import org.codehaus.jackson.map.ObjectMapper;
@@ -185,12 +184,4 @@ public class PublishedConfiguration {
     return sb.toString();
   }
 
-  /**
-   * Create an outputter for a given format
-   * @param format format to use
-   * @return an instance of output
-   */
-  public PublishedConfigurationOutputter createOutputter(ConfigFormat format) {
-    return PublishedConfigurationOutputter.createOutputter(format, this);
-  }
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/e98a5062/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/utils/PublishedConfigurationOutputter.java
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/utils/PublishedConfigurationOutputter.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/utils/PublishedConfigurationOutputter.java
index 8bdc102..76a2fbf 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/utils/PublishedConfigurationOutputter.java
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/utils/PublishedConfigurationOutputter.java
@@ -99,8 +99,6 @@ public abstract class PublishedConfigurationOutputter {
         return new PropertiesOutputter(owner);
       case JSON:
         return new JsonOutputter(owner);
-      case ENV:
-        return new EnvOutputter(owner);
       case TEMPLATE:
         return new TemplateOutputter(owner);
       case YAML:


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to