-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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
[SPARK-23464][MESOS] Fix mesos cluster scheduler options double-escaping #20641
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -199,6 +199,38 @@ class MesosClusterSchedulerSuite extends SparkFunSuite with LocalSparkContext wi | |
}) | ||
} | ||
|
||
test("properly wraps and escapes parameters passed to driver command") { | ||
setScheduler() | ||
|
||
val mem = 1000 | ||
val cpu = 1 | ||
|
||
val response = scheduler.submitDriver( | ||
new MesosDriverDescription("d1", "jar", mem, cpu, true, | ||
command, | ||
Map("spark.mesos.executor.home" -> "test", | ||
"spark.app.name" -> "test", | ||
// no special characters, wrap only | ||
"spark.driver.extraJavaOptions" -> | ||
"-XX+PrintGC -Dparam1=val1 -Dparam2=val2", | ||
// special characters, to be escaped | ||
"spark.executor.extraJavaOptions" -> | ||
"""-Dparam1="value 1" -Dparam2=value\ 2 -Dpath=$PATH"""), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure the second param (param2) would be parsed correctly if you actually ran the command. Doesn't there need to be quotes around the space? Have you tested it and checked if the executor gets the correct value for param2? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @susanxhuynh |
||
"s1", | ||
new Date())) | ||
assert(response.success) | ||
|
||
val offer = Utils.createOffer("o1", "s1", mem, cpu) | ||
scheduler.resourceOffers(driver, List(offer).asJava) | ||
val tasks = Utils.verifyTaskLaunched(driver, "o1") | ||
val driverCmd = tasks.head.getCommand.getValue | ||
assert(driverCmd.contains( | ||
"""--conf spark.driver.extraJavaOptions="-XX+PrintGC -Dparam1=val1 -Dparam2=val2"""")) | ||
assert(driverCmd.contains( | ||
"""--conf spark.executor.extraJavaOptions=""" | ||
+ """"-Dparam1=\"value 1\" -Dparam2=value\\ 2 -Dpath=\$PATH"""")) | ||
} | ||
|
||
test("supports spark.mesos.driverEnv.*") { | ||
setScheduler() | ||
|
||
|
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.
Does this test fail with the old code?
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.
It does.
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.
This looks ready to merge; anything else needed @skonto or @susanxhuynh ?
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.
That would be great to merge it if you think it's ready.
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 delay. I was going to test this in DC/OS and haven't gotten a chance to do so.
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.
@susanxhuynh I can do a test for this.