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_r368070021
##########
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:
Is there something you can do to clarify that this may not actually load any
additional configs?
----------------------------------------------------------------
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