dianfu commented on a change in pull request #16833:
URL: https://github.com/apache/flink/pull/16833#discussion_r689222816



##########
File path: docs/content.zh/docs/deployment/cli.md
##########
@@ -479,6 +479,14 @@ related options. Here's an overview of all the Python 
related options for the ac
                 f = open('data/data.txt', 'r').
             </td>
         </tr>
+        <tr>
+            <td><code 
class="highlighter-rouge">-pyclientexec,--pyClientExecutable</code></td>
+            <td>
+                The path of the Python interpreter used to launch the Python 
process when submitting
+                the Python jobs via \"flink run\" or compiling the Java/Scala 
jobs containing

Review comment:
       Give an example?

##########
File path: 
flink-python/src/main/java/org/apache/flink/client/python/PythonEnvUtils.java
##########
@@ -137,6 +143,27 @@ static PythonEnvironment preparePythonEnvironment(
                             .collect(Collectors.toList());
             addToPythonPath(env, pythonFiles);
         }
+
+        // 5. set the archives directory as the working directory, then user 
could access the
+        // content of the archives via relative path
+        if (config.getOptional(PYTHON_ARCHIVES).isPresent()
+                && (config.getOptional(PYTHON_CLIENT_EXECUTABLE).isPresent()
+                        || 
!System.getenv(PYFLINK_CLIENT_EXECUTABLE).isEmpty())) {
+            env.archivesDirectory = String.join(File.separator, tmpDir, 
PYTHON_ARCHIVES_DIR);
+            List<Path> pythonArchives =
+                    
Arrays.stream(config.get(PYTHON_ARCHIVES).split(FILE_DELIMITER))
+                            .map(Path::new)
+                            .collect(Collectors.toList());
+
+            // extract archives to archives directory
+            for (Path pythonArchive : pythonArchives) {
+                ZipUtils.extractZipFileWithPermissions(
+                        pythonArchive.getPath(),
+                        String.join(
+                                File.separator, env.archivesDirectory, 
pythonArchive.getName()));

Review comment:
       if python.archives is configured as venv.zip#myenv, the extracted 
directory name should be myenv

##########
File path: docs/content/docs/deployment/cli.md
##########
@@ -477,6 +477,14 @@ related options. Here's an overview of all the Python 
related options for the ac
                 f = open('data/data.txt', 'r').
             </td>
         </tr>
+        <tr>
+            <td><code 
class="highlighter-rouge">-pyclientexec,--pyClientExecutable</code></td>

Review comment:
       The description in PythonOptions.PYTHON_CLIENT_EXECUTABLE should also be 
updated.

##########
File path: 
flink-python/src/main/java/org/apache/flink/client/python/PythonEnvUtils.java
##########
@@ -137,6 +143,27 @@ static PythonEnvironment preparePythonEnvironment(
                             .collect(Collectors.toList());
             addToPythonPath(env, pythonFiles);
         }
+
+        // 5. set the archives directory as the working directory, then user 
could access the
+        // content of the archives via relative path
+        if (config.getOptional(PYTHON_ARCHIVES).isPresent()
+                && (config.getOptional(PYTHON_CLIENT_EXECUTABLE).isPresent()
+                        || 
!System.getenv(PYFLINK_CLIENT_EXECUTABLE).isEmpty())) {

Review comment:
       it may throw NPE as System.getenv(PYFLINK_CLIENT_EXECUTABLE) may return 
null




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to