hequn8128 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_r341476050
 
 

 ##########
 File path: 
flink-python/src/main/java/org/apache/flink/streaming/api/operators/python/AbstractPythonFunctionOperator.java
 ##########
 @@ -110,6 +116,23 @@ public void open() throws Exception {
                                LOG.info("The maximum bundle time is configured 
to {} milliseconds.", this.maxBundleTimeMills);
                        }
 
+                       String[] tmpDirectories =
+                               
getContainingTask().getEnvironment().getTaskManagerInfo().getTmpDirectories();
+                       Random rand = new Random();
+                       int tmpDirectoryIndex = rand.nextInt() % 
tmpDirectories.length;
+                       String pythonTmpDirectoryRoot = 
tmpDirectories[tmpDirectoryIndex];
+                       ExecutionConfig.GlobalJobParameters globalJobParameters 
= getExecutionConfig().getGlobalJobParameters();
+                       Map<String, String> parameters;
+                       if (globalJobParameters != null) {
 
 Review comment:
   globalJobParameters can not be null. Simplify it as
   ```
   PythonDependencyManager dependencyManager = 
PythonDependencyManager.createDependencyManager(
     getExecutionConfig().getGlobalJobParameters().toMap(),
     getRuntimeContext().getDistributedCache());
   ```

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to