kw2542 commented on a change in pull request #1248: SAMZA-2410: Update 
ClusterBasedJobCoordinator config retrieval logic from loader.
URL: https://github.com/apache/samza/pull/1248#discussion_r368079520
 
 

 ##########
 File path: samza-core/src/main/java/org/apache/samza/util/ConfigUtil.java
 ##########
 @@ -67,4 +72,42 @@ public static Config applyRewriter(Config config, String 
rewriterName) {
     LOG.info("Re-writing config with {}", rewriter);
     return rewriter.rewrite(rewriterName, config);
   }
+
+  /**
+   * Load full job config with {@link ConfigLoaderFactory} when present.
+   *
+   * @param original config
+   * @return full job config
+   */
+  public static Config loadConfig(Config original) {
+    JobConfig jobConfig = new JobConfig(original);
+    Config fullConfig = original;
+
+    if (jobConfig.getConfigLoaderFactory().isPresent()) {
+      ConfigLoaderFactory factory = 
ReflectionUtil.getObj(jobConfig.getConfigLoaderFactory().get(), 
ConfigLoaderFactory.class);
+      ConfigLoader loader = 
factory.getLoader(original.subset(ConfigLoaderFactory.CONFIG_LOADER_PROPERTIES_PREFIX));
+      // overrides config loaded with original config, which may contain 
overridden values.
+      fullConfig = ConfigUtil.rewriteConfig(override(loader.getConfig(), 
original));
+    }
+
+    return fullConfig;
+  }
+
+  /**
+   * Overrides original config with overridden values.
+   *
+   * @param original config to be overridden.
+   * @param overrides overridden values.
+   * @return the overridden config.
+   */
+  @SafeVarargs
+  public static Config override(Config original, Map<String, String>... 
overrides) {
 
 Review comment:
   Updated to private

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


With regards,
Apache Git Services

Reply via email to