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-22640][PYSPARK][YARN]switch python exec on executor side #19840
Conversation
Test build #84280 has finished for PR 19840 at commit
|
// 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") |
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.
Shouldn't this be handled in deploy/PythonRunner
?
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.
Yeah, PYSPARK_DRIVER_PYTHON
should be handled in deploy/PythonRunner
.
This PythonRunner
is for executors.
Should we set the Btw, just for confirmation, is |
It happens when specifing PYSPARK_PYTHON=/path/to/a/client/side/bin/python \
bin/spark-submit --master yarn --deploy-mode client \
--archives /path/to/a/client/side/python.zip \
--conf spark.yarn.appMasterEnv.PYSPARK_PYTHON=python.zip/somedir/bin/python \
--conf spark.executorEnv.PYSPARK_PYTHON=python.zip/somedir/bin/python \
exec.py whether yarn client or cluster, it fails
While not specifying
For cluster mode it succeeded, for client mode it fails because no module implemented for the system default python on the client node. |
I think in YARN we have several different ways to set Can you please:
I guess for other envs, it will also suffer from this problem, am I right? |
@jerryshao ENVs are specified ok by yarn, but the |
Oh, I see. You're running in client mode. So this one So I guess the behavior is expected. Because driver will honor With your above test, Normally I think we guarantee that driver and executors honor same python path, and executables exist in the whole cluster. So we don't need to set PYSPARK_PYTHON in executor side. Please correct me if I'm wrong. |
Yes, you are right. we should use same python executables. But I guess the same might mean binary same not just same path. For client mode, the driver is user side environment and flexible, but the default cluster setting might be opaque for users. Since we can use --archives to deliver whole python executables for executor side use, why not using it |
I'm a little concerned about such changes, this may be misconfigured to introduce the discrepancy between driver python and executor python, at least we should honor this configuration "spark.executorEnv.PYSPARK_PYTHON" unless the executables of ping @zjffdu , any thought? |
Instead of setting (Maybe it doesn't change anything because of |
@vanzin PYSPARK_DRIVER_PYTHON won't work because context.py#L191 does't deal with it |
use spark-2.2.0-bin-hadoop2.7 numpy examples/src/main/python/mllib/correlations_example.pycase 1
case 2
case 3 & 4
case 5 && 6
case 7
case 8
case 9
case 10
my humble opinions
PS: Why there are two python home variables -- PYSPARK_DRIVER_PYTHON & PYSPARK_PYTHON? |
@yaooqinn What's the difference between case 7 and 8? Looks like the same configuration but the different result? |
@ueshin case 8 should be client deploy mode, excuse me for copy mistake, fixed |
@yaooqinn OK, I see the situation. In client mode, I think we can't use In cluster mode, we can use Btw, Currently we handle only environment varibale but not |
@ueshin I can |
@yaooqinn I meant it is not used for |
@ueshin i see. |
@ueshin context.py#L191 set for both driver and executor? |
@yaooqinn It is used for executors. |
I'm trying to understand what is https://github.com/apache/spark/blob/master/python/pyspark/context.py#L191 really achieving. It seems pretty broken to me and feels like the whole It causes this problem because it forces the executor to use the driver's python even if it's been set to a different path by the user. It uses And it ignores the Instead, shouldn't the logic at https://github.com/apache/spark/blob/master/launcher/src/main/java/org/apache/spark/launcher/SparkSubmitCommandBuilder.java#L304 be used in |
@vanzin |
That's what I said in my comment ("except for the driver python config"). |
So, any updates here? |
@yaooqinn do you plan to update this PR? |
@vanzin I am not very familiar with python part context.py#L191, so handle it at Maybe someone else could help, sorry for the delay. |
Build finished. Test FAILed. |
I didn't read the entire thread here but what you want is this: --archives hdfs:///python36/python36.tgz#python36 --conf spark.pyspark.python=./python36/bin/python3.6 --conf spark.executorEnv.LD_LIBRARY_PATH=./python36/lib --driver-library-path /opt/python36/lib --conf spark.pyspark.driver.python=/opt/python36/bin/python3.6 |
@yaooqinn we should probably close this if you're not planning to look at the root of the problem, which seems to be on the python side. |
What changes were proposed in this pull request?
In the case above, I created a python environment, delivered it via
--arichives
, then visited it on Executor Node viaspark.executorEnv.PYSPARK_PYTHON
.But Executor seemed to use
PYSPARK_PYTHON=~/anaconda3/envs/py3/bin/python
instead ofspark.executorEnv.PYSPARK_PYTHON=py3.zip/py3/bin/python
, then application end with ioe.this pr aim to switch the python exec when user specifies it.
How was this patch tested?
manually verified with the case above.