- 
                Notifications
    
You must be signed in to change notification settings  - Fork 28.9k
 
[SPARK-29202][DEPLOY] Driver java options are not passed to driver process in Yarn client mode #25889
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| 
           ok to test  | 
    
| 
           cc @srowen  | 
    
| 
           BTW, @sandeep-katta .  | 
    
        
          
                launcher/src/main/java/org/apache/spark/launcher/SparkSubmitCommandBuilder.java
              
                Outdated
          
            Show resolved
            Hide resolved
        
      | 
           I'm not clear this is a bug. At least, this previously only applied to YARN cluster mode. See 6378d4b#diff-75e0f814aa3717db995fa701883dc4e1 . How would driver options be valid for YARN client mode?  | 
    
| 
           earlier the conditions is if it is not cluster-mode 
 earlier user can run application with by following ways Above condition is for case 4, now from Spark3 user can submit application using 1st 3 cases  | 
    
| 
           OK, so the point is that an unspecified deploy mode should be considered client for all RMs? I'd agree with that given other code. It's not specific to YARN, right?  | 
    
| 
           Test build #111175 has finished for PR 25889 at commit  
  | 
    
          
 Yes it is applicable to all RM, and by default it is client mode  | 
    
| 
           Test build #111181 has finished for PR 25889 at commit  
  | 
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK by me
| } | ||
| 
               | 
          ||
| @Test | ||
| public void testisClientMode() { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very minor: testIsClientMode
| 
           Test build #111257 has finished for PR 25889 at commit  
  | 
    
| 
           retest this please  | 
    
| 
           Retest this please.  | 
    
| @Test | ||
| public void testIsClientMode() { | ||
| // Default master is "local[*]" | ||
| SparkSubmitCommandBuilder launcher = | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
launcher -> builder.
| public void testIsClientMode() { | ||
| // Default master is "local[*]" | ||
| SparkSubmitCommandBuilder launcher = | ||
| newCommandBuilder(Collections.emptyList()); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we make line 256 ~ 257 into one line?
| SparkSubmitCommandBuilder launcher = | ||
| newCommandBuilder(Collections.emptyList()); | ||
| assertTrue("By default application run in local mode", | ||
| launcher.isClientMode(Collections.EMPTY_MAP)); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation? We use 2-space indentation in Java file. Please see the other test case.
| // --master yarn or it can be any RM | ||
| List<String> sparkSubmitArgs = Arrays.asList( | ||
| parser.MASTER, | ||
| "yarn"); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
List<String> sparkSubmitArgs = Arrays.asList(parser.MASTER, "yarn");
| "yarn"); | ||
| launcher = newCommandBuilder(sparkSubmitArgs); | ||
| assertTrue("By default deploy mode is client", | ||
| launcher.isClientMode(Collections.EMPTY_MAP)); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assertTrue("By default deploy mode is client", builder.isClientMode(Collections.EMPTY_MAP));
| parser.MASTER, | ||
| "mesos", | ||
| parser.DEPLOY_MODE, | ||
| "cluster"); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sparkSubmitArgs = Arrays.asList(parser.MASTER, "mesos", parser.DEPLOY_MODE, "cluster");
| parser.DEPLOY_MODE, | ||
| "cluster"); | ||
| launcher = newCommandBuilder(sparkSubmitArgs); | ||
| assertTrue(!launcher.isClientMode(Collections.EMPTY_MAP)); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assertTrue(! -> assertFalse(.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Finally, use Collections.emptyMap() instead of Collections.EMPTY_MAP. Collections.EMPTY_MAP gives us Unchecked assignment warning due to type mismatch. There are multiple instances.
| 
           Test build #111272 has finished for PR 25889 at commit  
  | 
    
| 
           Test build #111278 has finished for PR 25889 at commit  
  | 
    
| 
           Retest this please.  | 
    
| 
           Test build #111296 has started for PR 25889 at commit   | 
    
| 
           retest this please  | 
    
| 
           Test build #4884 has finished for PR 25889 at commit  
  | 
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, looks nicer.
| return userMaster == null || | ||
| "client".equals(userDeployMode) || | ||
| (!userMaster.equals("yarn") && userDeployMode == null); | ||
| userDeployMode == null; | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the last minute request, but shall we change three lines into one-liner?
-    return userMaster == null ||
-      "client".equals(userDeployMode) ||
-      (!userMaster.equals("yarn") && userDeployMode == null);
+    return userMaster == null || userDeployMode == null || "client".equals(userDeployMode);| 
           Test build #111394 has finished for PR 25889 at commit  
  | 
    
| 
           retest this please  | 
    
| 
           Test build #111441 has finished for PR 25889 at commit  
  | 
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, LGTM. Merged to master.
What changes were proposed in this pull request?
--driver-java-optionsis not passed to driver process if the user runs the application in Yarn client modeRun the below command
In Spark 2.4.4
In Spark 3.0
This issue is caused by SPARK-28980
Why are the changes needed?
Corrected the
isClientModeAPI implementationDoes this PR introduce any user-facing change?
No
How was this patch tested?
Manually,