cameronlee314 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_r367049517
 
 

 ##########
 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 = override(ConfigUtil.rewriteConfig(loader.getConfig()), 
original);
 
 Review comment:
   I think the config rewriter sometimes overrides existing configs, so I don't 
think you want to re-override back to the original.
   Does the existing flow do this override flow with the original config?

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to