Will-Lo commented on code in PR #3642:
URL: https://github.com/apache/gobblin/pull/3642#discussion_r1169250482


##########
gobblin-api/src/main/java/org/apache/gobblin/configuration/ConfigurationKeys.java:
##########
@@ -678,7 +678,9 @@ public class ConfigurationKeys {
    */
   public static final String MR_JOB_ROOT_DIR_KEY = "mr.job.root.dir";
   /** Specifies a static location in HDFS to upload jars to. Useful for 
sharing jars across different Gobblin runs.*/
+  @Deprecated // Deprecated; use MR_JARS_BASE_DIR instead
   public static final String MR_JARS_DIR = "mr.jars.dir";
+  public static final String MR_JARS_BASE_DIR = "mr.jars.base.dir";

Review Comment:
   Can you include here what is the benefit of using this new configuration key 
over the old configuration?



##########
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/mapreduce/MRJobLauncher.java:
##########
@@ -228,8 +231,17 @@ public MRJobLauncher(Properties jobProps, Configuration 
conf, SharedResourcesBro
       this.fs.delete(this.mrJobDir, true);
     }
     this.unsharedJarsDir = new Path(this.mrJobDir, JARS_DIR_NAME);
-    this.jarsDir = this.jobProps.containsKey(ConfigurationKeys.MR_JARS_DIR) ? 
new Path(
-        this.jobProps.getProperty(ConfigurationKeys.MR_JARS_DIR)) : 
this.unsharedJarsDir;
+
+    if (this.jobProps.containsKey(ConfigurationKeys.MR_JARS_BASE_DIR)) {
+      Path jarsBaseDir = new 
Path(this.jobProps.getProperty(ConfigurationKeys.MR_JARS_BASE_DIR));
+      String monthSuffix = new 
SimpleDateFormat("yyyy-MM").format(System.currentTimeMillis());
+      cleanUpOldJarsDirIfRequired(this.fs, jarsBaseDir);
+      this.jarsDir = new Path(jarsBaseDir, monthSuffix);
+    } else {

Review Comment:
   I think this would be easier having an else-if,
   ```
   } else if (this.jobProps.containsKey(ConfigurationKeys.MR_JARS_DIR)) { 
     this.jarsDir = this.jobProps.getProperty(ConfigurationKeys.MR_JARS_DIR);
   } else {
     this.jarsDir = this.unsharedJarsDir;
   }
   ```



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to