dianfu commented on a change in pull request #10017: [FLINK-14019][python] add
support for managing environment and dependencies of Python UDF in Flink Python
API
URL: https://github.com/apache/flink/pull/10017#discussion_r348868115
##########
File path: flink-python/pyflink/table/table_config.py
##########
@@ -274,6 +275,64 @@ def set_sql_dialect(self, sql_dialect):
"""
self._j_table_config.setSqlDialect(SqlDialect._to_j_sql_dialect(sql_dialect))
+ def set_python_executable(self, python_exec):
+ """
+ Set the path of the python interpreter for running the python udf on
workers.
+
+ e.g. "/usr/local/bin/python3".
+
+ If python UDFs need to run in a specific python environment and the
environment is not
+ exist on cluster, this method
:func:`pyflink.table.TableEnvironment.add_python_archive`
+ can be used to upload the packaged environment.
+ Then the python interpreter path of the uploaded environment can be
specified
+ via this method.
+
+ Example:
+ ::
+
+ # command executed in shell
+ # assert the relative path of python interpreter is
py_env/bin/python
+ $ zip -r py_env.zip py_env
+
+ # python code
+ >>> table_env.add_python_archive("py_env.zip", "myenv")
+ >>>
table_env.get_config().set_python_executable("myenv/py_env/bin/python")
+
+ # the files in archive is also accessible in UDF
Review comment:
This example can be removed as it has nothing to do with this interface.
What do you think?
----------------------------------------------------------------
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