shanthoosh commented on a change in pull request #920: SAMZA-2106: Samza app and job config refactor URL: https://github.com/apache/samza/pull/920#discussion_r258307442
########## File path: samza-core/src/main/java/org/apache/samza/execution/JobPlanner.java ########## @@ -155,4 +158,33 @@ final void writePlanJsonFile(String planJson) { systemStreamConfigs.put(JobConfig.JOB_DEFAULT_SYSTEM(), dsd.getSystemName())); return systemStreamConfigs; } + + /** + * Generates job.id from app.id and job.name from app.name config + * If both job.id and app.id is defined, app.id takes precedence and job.id is set to value of app.id + * If both job.name and app.name is defined, app.name takes precedence and job.name is set to value of app.name + * + * @param allowedUserConfig configs passed from user + */ + void generateJobIdAndName(Map<String, String> allowedUserConfig) { + if (allowedUserConfig.containsKey(JobConfig.JOB_ID())) { + LOG.warn("{} is a deprecated configuration, use app.id instead.", JobConfig.JOB_ID()); + } + + if (allowedUserConfig.containsKey(JobConfig.JOB_NAME())) { + LOG.warn("{} is a deprecated configuration, use use app.name instead.", JobConfig.JOB_NAME()); + } + + if (allowedUserConfig.containsKey(ApplicationConfig.APP_NAME)) { Review comment: It is a good practice not to mutate the arguments(`allowedUserConfig`) as a part of the method implementation. It will improve readability and be simpler when someone has to re-read again in the future. Rather than having return type void in this implementation, may be you can return the updated configuration, like ``` MapConfig calculateJobIdAndJobName(String jobName, String jobId) ``` At caller, you can simply add the return value you received from this method invocation to the final configuration bag. Please change if this makes sense. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services