dongjoon-hyun commented on a change in pull request #28200: 
[SPARK-31432][DEPLOY] bin/sbin scripts should allow to customize jars dir
URL: https://github.com/apache/spark/pull/28200#discussion_r409218728
 
 

 ##########
 File path: 
launcher/src/main/java/org/apache/spark/launcher/CommandBuilderUtils.java
 ##########
 @@ -314,18 +319,31 @@ static int javaMajorVersion(String javaVersion) {
    * or a distribution directory.
    */
   static String findJarsDir(String sparkHome, String scalaVersion, boolean 
failIfNotFound) {
+    String envSparkJarsDir = System.getenv(ENV_SPARK_JARS_DIR);
+    if (envSparkJarsDir != null && !envSparkJarsDir.isEmpty()) {
+      File envJarsDir = new File(envSparkJarsDir);
+      return handleJarsDir(envJarsDir, failIfNotFound,
+        "The specified SPARK_JARS_DIR '%s' does not exist; make sure 
SPARK_JARS_DIR is set appropriately.");
+    }
+    
     // TODO: change to the correct directory once the assembly build is 
changed.
     File libdir = new File(sparkHome, "jars");
     if (!libdir.isDirectory()) {
       libdir = new File(sparkHome, 
String.format("assembly/target/scala-%s/jars", scalaVersion));
-      if (!libdir.isDirectory()) {
-        checkState(!failIfNotFound,
-          "Library directory '%s' does not exist; make sure Spark is built.",
-          libdir.getAbsolutePath());
-        return null;
-      }
+      return handleJarsDir(libdir, failIfNotFound,
+          "Library directory '%s' does not exist; make sure Spark is built.");
     }
     return libdir.getAbsolutePath();
   }
 
+  private static String handleJarsDir(File theDir, boolean failIfNotFound, 
String message) { 
 
 Review comment:
   `theDir` -> `dir`.

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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to