Skip to content

Conversation

@sandeep-katta
Copy link
Contributor

@sandeep-katta sandeep-katta commented Sep 22, 2019

What changes were proposed in this pull request?

--driver-java-options is not passed to driver process if the user runs the application in Yarn client mode

Run the below command

./bin/spark-sql --master yarn \
--driver-java-options="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5555"

In Spark 2.4.4

java ... -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5555
org.apache.spark.deploy.SparkSubmit --master yarn --conf spark.driver.extraJavaOptions=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5555 ...

In Spark 3.0

java ...
org.apache.spark.deploy.SparkSubmit --master yarn --conf spark.driver.extraJavaOptions=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5556 ...

This issue is caused by SPARK-28980

Why are the changes needed?

Corrected the isClientMode API implementation

Does this PR introduce any user-facing change?

No

How was this patch tested?

Manually,

image

@dongjoon-hyun
Copy link
Member

ok to test

@dongjoon-hyun
Copy link
Member

cc @srowen

@dongjoon-hyun
Copy link
Member

BTW, @sandeep-katta .
Please use a live version example in the PR description. For example, 2.4.4 is the best. 2.3.x became EOL already.

@srowen
Copy link
Member

srowen commented Sep 23, 2019

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?

@sandeep-katta
Copy link
Contributor Author

earlier the conditions is if it is not cluster-mode

!userMaster.equals("yarn-cluster") && userDeployMode == null

earlier user can run application with by following ways
-- master yarn
--master yarn --deploy-mode cluster
--master yarn --deploy-mode client
--master yarn-cluster
--master yarn-client

Above condition is for case 4, now from Spark3 user can submit application using 1st 3 cases

@srowen
Copy link
Member

srowen commented Sep 23, 2019

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?

@SparkQA
Copy link

SparkQA commented Sep 23, 2019

Test build #111175 has finished for PR 25889 at commit e4ef428.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@sandeep-katta
Copy link
Contributor Author

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?

Yes it is applicable to all RM, and by default it is client mode

@SparkQA
Copy link

SparkQA commented Sep 23, 2019

Test build #111181 has finished for PR 25889 at commit 32760a7.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

Copy link
Member

@srowen srowen left a 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() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very minor: testIsClientMode

@SparkQA
Copy link

SparkQA commented Sep 24, 2019

Test build #111257 has finished for PR 25889 at commit ac8c36d.

  • This patch fails due to an unknown error code, -9.
  • This patch merges cleanly.
  • This patch adds no public classes.

@sandeep-katta
Copy link
Contributor Author

retest this please

@dongjoon-hyun
Copy link
Member

Retest this please.

@dongjoon-hyun dongjoon-hyun changed the title [SPARK-29202][Deploy]driver java options are not passed to driver process in Yarn client mode [SPARK-29202][Deploy] Driver java options are not passed to driver process in Yarn client mode Sep 24, 2019
@Test
public void testIsClientMode() {
// Default master is "local[*]"
SparkSubmitCommandBuilder launcher =
Copy link
Member

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());
Copy link
Member

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));
Copy link
Member

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");
Copy link
Member

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));
Copy link
Member

@dongjoon-hyun dongjoon-hyun Sep 24, 2019

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");
Copy link
Member

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));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assertTrue(! -> assertFalse(.

Copy link
Member

@dongjoon-hyun dongjoon-hyun Sep 24, 2019

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.

@SparkQA
Copy link

SparkQA commented Sep 24, 2019

Test build #111272 has finished for PR 25889 at commit ac8c36d.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Sep 24, 2019

Test build #111278 has finished for PR 25889 at commit 7b2497a.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@dongjoon-hyun
Copy link
Member

Retest this please.

@SparkQA
Copy link

SparkQA commented Sep 24, 2019

Test build #111296 has started for PR 25889 at commit 7b2497a.

@sandeep-katta
Copy link
Contributor Author

retest this please

@SparkQA
Copy link

SparkQA commented Sep 25, 2019

Test build #4884 has finished for PR 25889 at commit 7b2497a.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

Copy link
Member

@srowen srowen left a 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;
Copy link
Member

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

@SparkQA
Copy link

SparkQA commented Sep 26, 2019

Test build #111394 has finished for PR 25889 at commit 6f1ba43.

  • This patch fails due to an unknown error code, -9.
  • This patch merges cleanly.
  • This patch adds no public classes.

@vanzin
Copy link
Contributor

vanzin commented Sep 26, 2019

retest this please

@SparkQA
Copy link

SparkQA commented Sep 26, 2019

Test build #111441 has finished for PR 25889 at commit 6f1ba43.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@dongjoon-hyun dongjoon-hyun changed the title [SPARK-29202][Deploy] Driver java options are not passed to driver process in Yarn client mode [SPARK-29202][CORE] Driver java options are not passed to driver process in Yarn client mode Sep 26, 2019
@dongjoon-hyun dongjoon-hyun changed the title [SPARK-29202][CORE] Driver java options are not passed to driver process in Yarn client mode [SPARK-29202][DEPLOY] Driver java options are not passed to driver process in Yarn client mode Sep 26, 2019
Copy link
Member

@dongjoon-hyun dongjoon-hyun left a 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.

@dongjoon-hyun
Copy link
Member

Thank you, @srowen and @vanzin , too!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants