Github user tgravescs commented on a diff in the pull request:
https://github.com/apache/spark/pull/21468#discussion_r202171390
--- Diff:
resource-managers/yarn/src/main/scala/org/apache/spark/deploy/yarn/Client.scala
---
@@ -813,8 +813,20 @@ private[spark] class Client(
if (pythonPath.nonEmpty) {
val pythonPathStr = (sys.env.get("PYTHONPATH") ++ pythonPath)
.mkString(ApplicationConstants.CLASS_PATH_SEPARATOR)
- env("PYTHONPATH") = pythonPathStr
- sparkConf.setExecutorEnv("PYTHONPATH", pythonPathStr)
+ val newValue =
+ if (env.contains("PYTHONPATH")) {
+ env("PYTHONPATH") + ApplicationConstants.CLASS_PATH_SEPARATOR +
pythonPathStr
+ } else {
+ pythonPathStr
+ }
+ env("PYTHONPATH") = newValue
+ if (!sparkConf.getExecutorEnv.toMap.contains("PYTHONPATH")) {
+ sparkConf.setExecutorEnv("PYTHONPATH", pythonPathStr)
+ } else {
+ val pythonPathExecutorEnv =
sparkConf.getExecutorEnv.toMap.get("PYTHONPATH").get +
+ ApplicationConstants.CLASS_PATH_SEPARATOR + pythonPathStr
+ sparkConf.setExecutorEnv("PYTHONPATH", pythonPathExecutorEnv)
--- End diff --
move the setExecutorEnv outside of the if and have the if return the value.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]