[GitHub] spark pull request #21476: [SPARK-24446][yarn] Properly quote library path f...
Github user asfgit closed the pull request at: https://github.com/apache/spark/pull/21476 --- - To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #21476: [SPARK-24446][yarn] Properly quote library path f...
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-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #21476: [SPARK-24446][yarn] Properly quote library path f...
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-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #21476: [SPARK-24446][yarn] Properly quote library path f...
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-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #21476: [SPARK-24446][yarn] Properly quote library path f...
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-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[GitHub] spark pull request #21476: [SPARK-24446][yarn] Properly quote library path f...
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-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org
[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 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-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org