yaooqinn closed pull request #19840: [SPARK-22640][PYSPARK][YARN]switch python
exec on executor side
URL: https://github.com/apache/spark/pull/19840
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/core/src/main/scala/org/apache/spark/api/python/PythonRunner.scala
b/core/src/main/scala/org/apache/spark/api/python/PythonRunner.scala
index f524de68fbce0..9d16dbbe9a0c8 100644
--- a/core/src/main/scala/org/apache/spark/api/python/PythonRunner.scala
+++ b/core/src/main/scala/org/apache/spark/api/python/PythonRunner.scala
@@ -57,9 +57,14 @@ private[spark] abstract class BasePythonRunner[IN, OUT](
require(funcs.length == argOffsets.length, "argOffsets should have the same
length as funcs")
+ private val env = SparkEnv.get
+ private val conf = env.conf
+
// All the Python functions should have the same exec, version and envvars.
protected val envVars = funcs.head.funcs.head.envVars
- protected val pythonExec = funcs.head.funcs.head.pythonExec
+ protected val pythonExec =
conf.getOption("spark.executorEnv.PYSPARK_DRIVER_PYTHON")
+ .getOrElse(conf.getOption("spark.executorEnv.PYSPARK_PYTHON")
+ .getOrElse(funcs.head.funcs.head.pythonExec))
protected val pythonVer = funcs.head.funcs.head.pythonVer
// TODO: support accumulator in multiple UDF
@@ -70,7 +75,6 @@ private[spark] abstract class BasePythonRunner[IN, OUT](
partitionIndex: Int,
context: TaskContext): Iterator[OUT] = {
val startTime = System.currentTimeMillis
- val env = SparkEnv.get
val localdir = env.blockManager.diskBlockManager.localDirs.map(f =>
f.getPath()).mkString(",")
envVars.put("SPARK_LOCAL_DIRS", localdir) // it's also used in monitor
thread
if (reuseWorker) {
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]