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_r365993189
##########
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:
Eventually Yes, but during the migration, there will be cases where jobs are
still following the legacy submission flow, but still goes to this new method
in code.
For example, this util will be called by LocalApplicationRunner too, which
will first support both legacy and new flow.
----------------------------------------------------------------
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