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_r341476368
 
 

 ##########
 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];
 
 Review comment:
   Maybe extract these logic into a small method? Putting all logic in the open 
makes it a mess.

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

Reply via email to