You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@heron.apache.org by GitBox <gi...@apache.org> on 2018/04/03 18:55:03 UTC

[GitHub] kramasamy closed pull request #2845: add config for apiserver overrides

kramasamy closed pull request #2845: add config for apiserver overrides
URL: https://github.com/apache/incubator-heron/pull/2845
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/heron/schedulers/src/java/com/twitter/heron/scheduler/nomad/NomadScheduler.java b/heron/schedulers/src/java/com/twitter/heron/scheduler/nomad/NomadScheduler.java
index 2bdac1e0e8..a27040aa1d 100644
--- a/heron/schedulers/src/java/com/twitter/heron/scheduler/nomad/NomadScheduler.java
+++ b/heron/schedulers/src/java/com/twitter/heron/scheduler/nomad/NomadScheduler.java
@@ -70,7 +70,8 @@ public void initialize(Config config, Config runtime) {
         .putAll(config)
         .putAll(ConfigLoader.loadConfig(
             Context.heronHome(config), Context.heronConf(config),
-            null, Context.overrideFile(config)))
+            null, Context.apiserverOverrideFile(config) != null
+                ? Context.apiserverOverrideFile(config) : Context.overrideFile(config)))
         .build());
     this.runtimeConfig = runtime;
     this.updateTopologyManager =
diff --git a/heron/spi/src/java/com/twitter/heron/spi/common/Context.java b/heron/spi/src/java/com/twitter/heron/spi/common/Context.java
index 7438beeeb0..27a5dfb3c7 100644
--- a/heron/spi/src/java/com/twitter/heron/spi/common/Context.java
+++ b/heron/spi/src/java/com/twitter/heron/spi/common/Context.java
@@ -297,6 +297,10 @@ public static String overrideFile(Config cfg) {
     return cfg.getStringValue(Key.OVERRIDE_YAML);
   }
 
+  public static String apiserverOverrideFile(Config cfg) {
+    return cfg.getStringValue(Key.APISERVER_OVERRIDE_YAML);
+  }
+
   public static String executorBinary(Config cfg) {
     return cfg.getStringValue(Key.EXECUTOR_BINARY);
   }
diff --git a/heron/spi/src/java/com/twitter/heron/spi/common/Key.java b/heron/spi/src/java/com/twitter/heron/spi/common/Key.java
index 66d3313bd2..acd74e3757 100644
--- a/heron/spi/src/java/com/twitter/heron/spi/common/Key.java
+++ b/heron/spi/src/java/com/twitter/heron/spi/common/Key.java
@@ -165,6 +165,10 @@
   //keys for heron configuration files on the cluster
   OVERRIDE_YAML("heron.config.file.override.yaml",  "${HERON_CONF}/override.yaml"),
 
+  // Path to the config overrides passed into the apiserver. Only applicable to submitting
+  // topologies via apiserver
+  APISERVER_OVERRIDE_YAML("heron.apiserver.file.override.yaml", Type.STRING),
+
   //keys for config provided user binaries
   EXECUTOR_BINARY       ("heron.binaries.executor",        "${HERON_BIN}/heron-executor"),
   STMGR_BINARY          ("heron.binaries.stmgr",           "${HERON_BIN}/heron-stmgr"),
diff --git a/heron/tools/apiserver/src/java/com/twitter/heron/apiserver/utils/ConfigUtils.java b/heron/tools/apiserver/src/java/com/twitter/heron/apiserver/utils/ConfigUtils.java
index ddf750a500..05e5673e1c 100644
--- a/heron/tools/apiserver/src/java/com/twitter/heron/apiserver/utils/ConfigUtils.java
+++ b/heron/tools/apiserver/src/java/com/twitter/heron/apiserver/utils/ConfigUtils.java
@@ -32,6 +32,7 @@
 import com.twitter.heron.scheduler.utils.SubmitterUtils;
 import com.twitter.heron.spi.common.Config;
 import com.twitter.heron.spi.common.ConfigLoader;
+import com.twitter.heron.spi.common.Key;
 
 public final class ConfigUtils {
 
@@ -62,10 +63,17 @@ public static Config getBaseConfiguration(String heronDirectory,
         String releaseFile,
         String overrideConfigurationFile) {
     // TODO add release file
-    return ConfigLoader.loadConfig(heronDirectory,
+    Config config = ConfigLoader.loadConfig(heronDirectory,
         heronConfigDirectory,
         releaseFile,
         overrideConfigurationFile);
+    // Put location of the override file in the config so that schedulers invoked by
+    // the apiserver can load the override configs if needed. OVERRIDE_YAML cannot be used
+    // to set this because then the location will get passed on to the heron executors
+    return Config.newBuilder()
+        .putAll(config)
+        .put(Key.APISERVER_OVERRIDE_YAML, overrideConfigurationFile)
+        .build();
   }
 
   public static Config getTopologyConfig(String topologyPackage, String topologyBinaryFile,


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services