This is an automated email from the ASF dual-hosted git repository.

dianfu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/master by this push:
     new 2897554  [hotfix][python][docs] Improve the documentation about Python 
dependency management
2897554 is described below

commit 28975540a82be6a5d831a011f3bb10f4fac1f8c0
Author: Dian Fu <[email protected]>
AuthorDate: Thu Jan 7 13:40:33 2021 +0800

    [hotfix][python][docs] Improve the documentation about Python dependency 
management
---
 .../python/datastream-api-users-guide/dependency_management.md   | 9 +++++----
 .../datastream-api-users-guide/dependency_management.zh.md       | 9 +++++----
 docs/dev/python/table-api-users-guide/dependency_management.md   | 9 +++++----
 .../dev/python/table-api-users-guide/dependency_management.zh.md | 9 +++++----
 4 files changed, 20 insertions(+), 16 deletions(-)

diff --git 
a/docs/dev/python/datastream-api-users-guide/dependency_management.md 
b/docs/dev/python/datastream-api-users-guide/dependency_management.md
index f14c71b..fffeed0 100644
--- a/docs/dev/python/datastream-api-users-guide/dependency_management.md
+++ b/docs/dev/python/datastream-api-users-guide/dependency_management.md
@@ -71,7 +71,7 @@ echo numpy==1.16.5 > requirements.txt
 pip download -d cached_dir -r requirements.txt --no-binary :all:
 
 # python code
-stream_execution_environment.set_python_requirements("requirements.txt", 
"cached_dir")
+stream_execution_environment.set_python_requirements("/path/to/requirements.txt",
 "cached_dir")
 {% endhighlight %}
         <p>Please make sure the installation packages matches the platform of 
the cluster and the python version used. These packages will be installed using 
pip, so also make sure the version of Pip (version >= 7.1.0) and the version of 
Setuptools (version >= 37.0.0).</p>
       </td>
@@ -86,9 +86,9 @@ 
stream_execution_environment.set_python_requirements("requirements.txt", "cached
 zip -r py_env.zip py_env
 
 # python code
-stream_execution_environment.add_python_archive("py_env.zip")
+stream_execution_environment.add_python_archive("/path/to/py_env.zip")
 # or
-stream_execution_environment.add_python_archive("py_env.zip", "myenv")
+stream_execution_environment.add_python_archive("/path/to/py_env.zip", "myenv")
 
 # the files contained in the archive file can be accessed in UDF
 def my_func():
@@ -103,9 +103,10 @@ def my_func():
       <td>
         <p>Sets the path of the python interpreter which is used to execute 
the python udf workers, e.g., "/usr/local/bin/python3".</p>
 {% highlight python %}
-stream_execution_environment.add_python_archive("py_env.zip")
+stream_execution_environment.add_python_archive("/path/to/py_env.zip")
 
stream_execution_environment.get_config().set_python_executable("py_env.zip/py_env/bin/python")
 {% endhighlight %}
+        <p>Please note that if the path of the python interpreter comes from 
the uploaded python archive, the path specified in set_python_executable should 
be a relative path.</p>
         <p>Please make sure that the specified environment matches the 
platform that the cluster is running on.</p>
       </td>
     </tr>
diff --git 
a/docs/dev/python/datastream-api-users-guide/dependency_management.zh.md 
b/docs/dev/python/datastream-api-users-guide/dependency_management.zh.md
index 2941b97..66d7b27 100644
--- a/docs/dev/python/datastream-api-users-guide/dependency_management.zh.md
+++ b/docs/dev/python/datastream-api-users-guide/dependency_management.zh.md
@@ -72,7 +72,7 @@ echo numpy==1.16.5 > requirements.txt
 pip download -d cached_dir -r requirements.txt --no-binary :all:
 
 # Python 代码
-stream_execution_environment.set_python_requirements("requirements.txt", 
"cached_dir")
+stream_execution_environment.set_python_requirements("/path/to/requirements.txt",
 "cached_dir")
 {% endhighlight %}
         <p>请确保这些依赖安装包和集群运行环境所使用的 Python 版本相匹配。此外,这些依赖将通过 Pip 安装, 请确保 Pip 
的版本(version >= 7.1.0) 和 Setuptools 的版本(version >= 37.0.0)符合要求。</p>
       </td>
@@ -87,9 +87,9 @@ 
stream_execution_environment.set_python_requirements("requirements.txt", "cached
 zip -r py_env.zip py_env
 
 # python 代码
-stream_execution_environment.add_python_archive("py_env.zip")
+stream_execution_environment.add_python_archive("/path/to/py_env.zip")
 # 或者
-stream_execution_environment.add_python_archive("py_env.zip", "myenv")
+stream_execution_environment.add_python_archive("/path/to/py_env.zip", "myenv")
 
 # 归档文件中的文件可以被 Python 函数读取
 def my_func():
@@ -104,9 +104,10 @@ def my_func():
       <td>
         <p>配置用于执行 Python Worker 的 Python 解释器路径,如 "/usr/local/bin/python3"。</p>
 {% highlight python %}
-stream_execution_environment.add_python_archive("py_env.zip")
+stream_execution_environment.add_python_archive("/path/to/py_env.zip")
 
stream_execution_environment.get_config().set_python_executable("py_env.zip/py_env/bin/python")
 {% endhighlight %}
+        <p>如果 Python 解释器的路径指向上传的 Python 归档文件,那么通过 set_python_executable 设置的 
Python 解释器的路径必须是相对路径。</p>
         <p>请确保配置的 Python 环境和集群运行环境匹配。</p>
       </td>
     </tr>
diff --git a/docs/dev/python/table-api-users-guide/dependency_management.md 
b/docs/dev/python/table-api-users-guide/dependency_management.md
index 247f485..9eac728 100644
--- a/docs/dev/python/table-api-users-guide/dependency_management.md
+++ b/docs/dev/python/table-api-users-guide/dependency_management.md
@@ -71,7 +71,7 @@ echo numpy==1.16.5 > requirements.txt
 pip download -d cached_dir -r requirements.txt --no-binary :all:
 
 # python code
-table_env.set_python_requirements("requirements.txt", "cached_dir")
+table_env.set_python_requirements("/path/to/requirements.txt", "cached_dir")
 {% endhighlight %}
         <p>Please make sure the installation packages matches the platform of 
the cluster and the python version used. These packages will be installed using 
pip, so also make sure the version of Pip (version >= 7.1.0) and the version of 
SetupTools (version >= 37.0.0).</p>
       </td>
@@ -86,9 +86,9 @@ table_env.set_python_requirements("requirements.txt", 
"cached_dir")
 zip -r py_env.zip py_env
 
 # python code
-table_env.add_python_archive("py_env.zip")
+table_env.add_python_archive("/path/to/py_env.zip")
 # or
-table_env.add_python_archive("py_env.zip", "myenv")
+table_env.add_python_archive("/path/to/py_env.zip", "myenv")
 
 # the files contained in the archive file can be accessed in UDF
 def my_udf():
@@ -103,9 +103,10 @@ def my_udf():
       <td>
         <p>Sets the path of the python interpreter which is used to execute 
the python udf workers, e.g., "/usr/local/bin/python3".</p>
 {% highlight python %}
-table_env.add_python_archive("py_env.zip")
+table_env.add_python_archive("/path/to/py_env.zip")
 table_env.get_config().set_python_executable("py_env.zip/py_env/bin/python")
 {% endhighlight %}
+        <p>Please note that if the path of the python interpreter comes from 
the uploaded python archive, the path specified in set_python_executable should 
be a relative path.</p>
         <p>Please make sure that the specified environment matches the 
platform that the cluster is running on.</p>
       </td>
     </tr>
diff --git a/docs/dev/python/table-api-users-guide/dependency_management.zh.md 
b/docs/dev/python/table-api-users-guide/dependency_management.zh.md
index f1a021b..2e03f6e 100644
--- a/docs/dev/python/table-api-users-guide/dependency_management.zh.md
+++ b/docs/dev/python/table-api-users-guide/dependency_management.zh.md
@@ -75,7 +75,7 @@ echo numpy==1.16.5 > requirements.txt
 pip download -d cached_dir -r requirements.txt --no-binary :all:
 
 # python 代码
-table_env.set_python_requirements("requirements.txt", "cached_dir")
+table_env.set_python_requirements("/path/to/requirements.txt", "cached_dir")
 {% endhighlight %}
         <p>请确保这些依赖安装包和集群运行环境所使用的 Python 版本相匹配。此外,这些依赖将通过 Pip 安装, 请确保 Pip 
的版本(version >= 7.1.0) 和 Setuptools 的版本(version >= 37.0.0)符合要求。</p>
       </td>
@@ -90,9 +90,9 @@ table_env.set_python_requirements("requirements.txt", 
"cached_dir")
 zip -r py_env.zip py_env
 
 # python 代码
-table_env.add_python_archive("py_env.zip")
+table_env.add_python_archive("/path/to/py_env.zip")
 # 或者
-table_env.add_python_archive("py_env.zip", "myenv")
+table_env.add_python_archive("/path/to/py_env.zip", "myenv")
 
 # 归档文件中的文件可以被 Python 函数读取
 def my_udf():
@@ -107,9 +107,10 @@ def my_udf():
       <td>
         <p>配置用于执行 Python Worker 的 Python 解释器路径,如 "/usr/local/bin/python3"。</p>
 {% highlight python %}
-table_env.add_python_archive("py_env.zip")
+table_env.add_python_archive("/path/to/py_env.zip")
 table_env.get_config().set_python_executable("py_env.zip/py_env/bin/python")
 {% endhighlight %}
+        <p>如果 Python 解释器的路径指向上传的 Python 归档文件,那么通过 set_python_executable 设置的 
Python 解释器的路径必须是相对路径。</p>
         <p>请确保配置的 Python 环境和集群运行环境匹配。</p>
       </td>
     </tr>

Reply via email to