hequn8128 commented on a change in pull request #10061: [FLINK-14581][python]
Let python UDF execution no longer rely on the flink directory structure to
support running python UDFs on yarn.
URL: https://github.com/apache/flink/pull/10061#discussion_r347237461
##########
File path: flink-python/bin/pyflink-shell.sh
##########
@@ -34,11 +34,10 @@ PYFLINK_PYTHON="${PYFLINK_PYTHON:-"python"}"
export FLINK_BIN_DIR=$FLINK_BIN_DIR
export FLINK_HOME
-# Add pyflink & py4j & cloudpickle to PYTHONPATH
-export PYTHONPATH="$FLINK_OPT_DIR/python/pyflink.zip:$PYTHONPATH"
-PY4J_ZIP=`echo "$FLINK_OPT_DIR"/python/py4j-*-src.zip`
-CLOUDPICKLE_ZIP=`echo "$FLINK_OPT_DIR"/python/cloudpickle-*-src.zip`
-export PYTHONPATH="$PY4J_ZIP:$CLOUDPICKLE_ZIP:$PYTHONPATH"
+EXTRACTOR="org.apache.flink.client.python.PythonResourceExtractor"
+PYFLINK_INTERNAL_LIB=`${JAVA_RUN} ${JVM_ARGS} -cp ${PYTHON_JAR_PATH}
${EXTRACTOR}`
+export PYTHONPATH="$PYFLINK_INTERNAL_LIB:$PYTHONPATH"
+export PYFLINK_INTERNAL_LIB
Review comment:
Also clean temp files of `PYFLINK_INTERNAL_LIB` after executing
`pyflink.shell`. If python shell exits abnormally, the file would not be
cleaned.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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