You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by vanzin <gi...@git.apache.org> on 2018/05/31 22:41:51 UTC
[GitHub] spark pull request #21476: [SPARK-24446][yarn] Properly quote library path f...
GitHub user vanzin opened a pull request:
https://github.com/apache/spark/pull/21476
[SPARK-24446][yarn] Properly quote library path for YARN.
Because the way YARN executes commands via bash -c, everything needs
to be quoted so that the whole command is fully contained inside a
bash string and is interpreted correctly when the string is read by
bash. This is a bit different than the quoting done when executing
things as if typing in a bash shell.
Tweaked unit tests to exercise the bad behavior, which would cause
existing tests to time out without the fix. Also tested on a real
cluster, verifying the shell script created by YARN to run the
container.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/vanzin/spark SPARK-24446
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/21476.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #21476
----
commit 0a3b71f9085d74c9ced427534a8792ec633b0539
Author: Marcelo Vanzin <va...@...>
Date: 2018-05-30T23:50:10Z
[SPARK-24446][yarn] Properly quote library path for YARN.
Because the way YARN executes commands via bash -c, everything needs
to be quoted so that the whole command is fully contained inside a
bash string and is interpreted correctly when the string is read by
bash. This is a bit different than the quoting done when executing
things as if typing in a bash shell.
Tweaked unit tests to exercise the bad behavior, which would cause
existing tests to time out without the fix. Also tested on a real
cluster, verifying the shell script created by YARN to run the
container.
----
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #21476: [SPARK-24446][yarn] Properly quote library path f...
Posted by felixcheung <gi...@git.apache.org>.
Github user felixcheung commented on a diff in the pull request:
https://github.com/apache/spark/pull/21476#discussion_r192295158
--- Diff: resource-managers/yarn/src/main/scala/org/apache/spark/deploy/yarn/Client.scala ---
@@ -1485,6 +1486,22 @@ private object Client extends Logging {
YarnAppReport(report.getYarnApplicationState(), report.getFinalApplicationStatus(), diagsOpt)
}
+ /**
+ * Create a properly quoted library path string to be added as a prefix to the command executed by
+ * YARN. This is different from plain quoting due to YARN executing the command through "bash -c".
+ */
+ def createLibraryPathPrefix(libpath: String, conf: SparkConf): String = {
--- End diff --
maybe pull this into a util class and have unit tests?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #21476: [SPARK-24446][yarn] Properly quote library path for YARN...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/21476
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution/3798/
Test PASSed.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #21476: [SPARK-24446][yarn] Properly quote library path for YARN...
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:
https://github.com/apache/spark/pull/21476
**[Test build #91370 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/91370/testReport)** for PR 21476 at commit [`0a3b71f`](https://github.com/apache/spark/commit/0a3b71f9085d74c9ced427534a8792ec633b0539).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds no public classes.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #21476: [SPARK-24446][yarn] Properly quote library path for YARN...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/21476
Merged build finished. Test PASSed.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #21476: [SPARK-24446][yarn] Properly quote library path for YARN...
Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on the issue:
https://github.com/apache/spark/pull/21476
If there are no more comments I plan to push this next week.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #21476: [SPARK-24446][yarn] Properly quote library path for YARN...
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:
https://github.com/apache/spark/pull/21476
**[Test build #92388 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/92388/testReport)** for PR 21476 at commit [`87e207c`](https://github.com/apache/spark/commit/87e207c768c4aa958fb1b8e3b2899d1b7f99c41e).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds no public classes.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #21476: [SPARK-24446][yarn] Properly quote library path for YARN...
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:
https://github.com/apache/spark/pull/21476
**[Test build #91454 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/91454/testReport)** for PR 21476 at commit [`87e207c`](https://github.com/apache/spark/commit/87e207c768c4aa958fb1b8e3b2899d1b7f99c41e).
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #21476: [SPARK-24446][yarn] Properly quote library path for YARN...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/21476
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/92388/
Test PASSed.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #21476: [SPARK-24446][yarn] Properly quote library path for YARN...
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:
https://github.com/apache/spark/pull/21476
**[Test build #91370 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/91370/testReport)** for PR 21476 at commit [`0a3b71f`](https://github.com/apache/spark/commit/0a3b71f9085d74c9ced427534a8792ec633b0539).
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #21476: [SPARK-24446][yarn] Properly quote library path for YARN...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/21476
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution/4039/
Test PASSed.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #21476: [SPARK-24446][yarn] Properly quote library path f...
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/spark/pull/21476
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #21476: [SPARK-24446][yarn] Properly quote library path for YARN...
Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on the issue:
https://github.com/apache/spark/pull/21476
Merging to master.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #21476: [SPARK-24446][yarn] Properly quote library path for YARN...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/21476
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution-unified/518/
Test PASSed.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #21476: [SPARK-24446][yarn] Properly quote library path for YARN...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/21476
Merged build finished. Test PASSed.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #21476: [SPARK-24446][yarn] Properly quote library path f...
Posted by redsanket <gi...@git.apache.org>.
Github user redsanket commented on a diff in the pull request:
https://github.com/apache/spark/pull/21476#discussion_r192804713
--- Diff: resource-managers/yarn/src/main/scala/org/apache/spark/deploy/yarn/Client.scala ---
@@ -1485,6 +1486,22 @@ private object Client extends Logging {
YarnAppReport(report.getYarnApplicationState(), report.getFinalApplicationStatus(), diagsOpt)
}
+ /**
+ * Create a properly quoted library path string to be added as a prefix to the command executed by
+ * YARN. This is different from plain quoting due to YARN executing the command through "bash -c".
+ */
+ def createLibraryPathPrefix(libpath: String, conf: SparkConf): String = {
+ val cmdPrefix = if (Utils.isWindows) {
+ Utils.libraryPathEnvPrefix(Seq(libpath))
+ } else {
+ val envName = Utils.libraryPathEnvName
+ // For quotes, escape both the quote and the escape character when encoding in the command
+ // string.
+ val quoted = libpath.replace("\"", "\\\\\\\"")
--- End diff --
Dumb question i think escaping "\"" => "\\\"". Not sure why we have so many escapes otherwise. Trying to understand, else PR looks good
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #21476: [SPARK-24446][yarn] Properly quote library path f...
Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on a diff in the pull request:
https://github.com/apache/spark/pull/21476#discussion_r192476723
--- Diff: resource-managers/yarn/src/main/scala/org/apache/spark/deploy/yarn/Client.scala ---
@@ -1485,6 +1486,22 @@ private object Client extends Logging {
YarnAppReport(report.getYarnApplicationState(), report.getFinalApplicationStatus(), diagsOpt)
}
+ /**
+ * Create a properly quoted library path string to be added as a prefix to the command executed by
+ * YARN. This is different from plain quoting due to YARN executing the command through "bash -c".
+ */
+ def createLibraryPathPrefix(libpath: String, conf: SparkConf): String = {
--- End diff --
This is so specific to the way YARN runs things that I don't think it would be useful anywhere else. If at some point it becomes useful, the code can be moved.
I think the tests I added are better than just unit testing this function, since that way the code is actually being run through YARN and bash.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #21476: [SPARK-24446][yarn] Properly quote library path for YARN...
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:
https://github.com/apache/spark/pull/21476
**[Test build #92388 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/92388/testReport)** for PR 21476 at commit [`87e207c`](https://github.com/apache/spark/commit/87e207c768c4aa958fb1b8e3b2899d1b7f99c41e).
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #21476: [SPARK-24446][yarn] Properly quote library path for YARN...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/21476
Merged build finished. Test PASSed.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #21476: [SPARK-24446][yarn] Properly quote library path f...
Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on a diff in the pull request:
https://github.com/apache/spark/pull/21476#discussion_r192814446
--- Diff: resource-managers/yarn/src/main/scala/org/apache/spark/deploy/yarn/Client.scala ---
@@ -1485,6 +1486,22 @@ private object Client extends Logging {
YarnAppReport(report.getYarnApplicationState(), report.getFinalApplicationStatus(), diagsOpt)
}
+ /**
+ * Create a properly quoted library path string to be added as a prefix to the command executed by
+ * YARN. This is different from plain quoting due to YARN executing the command through "bash -c".
+ */
+ def createLibraryPathPrefix(libpath: String, conf: SparkConf): String = {
+ val cmdPrefix = if (Utils.isWindows) {
+ Utils.libraryPathEnvPrefix(Seq(libpath))
+ } else {
+ val envName = Utils.libraryPathEnvName
+ // For quotes, escape both the quote and the escape character when encoding in the command
+ // string.
+ val quoted = libpath.replace("\"", "\\\\\\\"")
--- End diff --
This needs to be double escaped because it goes through two rounds of bash interpreting the value.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #21476: [SPARK-24446][yarn] Properly quote library path for YARN...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/21476
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/91370/
Test PASSed.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark pull request #21476: [SPARK-24446][yarn] Properly quote library path f...
Posted by felixcheung <gi...@git.apache.org>.
Github user felixcheung commented on a diff in the pull request:
https://github.com/apache/spark/pull/21476#discussion_r192551676
--- Diff: resource-managers/yarn/src/main/scala/org/apache/spark/deploy/yarn/Client.scala ---
@@ -1485,6 +1486,22 @@ private object Client extends Logging {
YarnAppReport(report.getYarnApplicationState(), report.getFinalApplicationStatus(), diagsOpt)
}
+ /**
+ * Create a properly quoted library path string to be added as a prefix to the command executed by
+ * YARN. This is different from plain quoting due to YARN executing the command through "bash -c".
+ */
+ def createLibraryPathPrefix(libpath: String, conf: SparkConf): String = {
--- End diff --
k
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #21476: [SPARK-24446][yarn] Properly quote library path for YARN...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/21476
Merged build finished. Test PASSed.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #21476: [SPARK-24446][yarn] Properly quote library path for YARN...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/21476
Merged build finished. Test PASSed.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #21476: [SPARK-24446][yarn] Properly quote library path for YARN...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/21476
Merged build finished. Test PASSed.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #21476: [SPARK-24446][yarn] Properly quote library path for YARN...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/21476
Merged build finished. Test PASSed.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #21476: [SPARK-24446][yarn] Properly quote library path for YARN...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/21476
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/91454/
Test PASSed.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #21476: [SPARK-24446][yarn] Properly quote library path for YARN...
Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:
https://github.com/apache/spark/pull/21476
**[Test build #91454 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/91454/testReport)** for PR 21476 at commit [`87e207c`](https://github.com/apache/spark/commit/87e207c768c4aa958fb1b8e3b2899d1b7f99c41e).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds no public classes.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #21476: [SPARK-24446][yarn] Properly quote library path for YARN...
Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:
https://github.com/apache/spark/pull/21476
Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution/3745/
Test PASSed.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #21476: [SPARK-24446][yarn] Properly quote library path for YARN...
Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on the issue:
https://github.com/apache/spark/pull/21476
Merging to master.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] spark issue #21476: [SPARK-24446][yarn] Properly quote library path for YARN...
Posted by vanzin <gi...@git.apache.org>.
Github user vanzin commented on the issue:
https://github.com/apache/spark/pull/21476
retest this please
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org