hequn8128 commented on a change in pull request #10870: [FLINK-15616][python] 
Move boot error messages from python-udf-boot.log to taskmanager's log file
URL: https://github.com/apache/flink/pull/10870#discussion_r367893180
 
 

 ##########
 File path: 
flink-python/src/main/java/org/apache/flink/python/AbstractPythonFunctionRunner.java
 ##########
 @@ -176,10 +179,29 @@ public void open() throws Exception {
                Struct pipelineOptions = 
PipelineOptionsTranslation.toProto(portableOptions);
 
                jobBundleFactory = createJobBundleFactory(pipelineOptions);
-               stageBundleFactory = 
jobBundleFactory.forStage(createExecutableStage());
+               stageBundleFactory = createStageBundleFactory();
                progressHandler = BundleProgressHandler.ignored();
        }
 
+       /**
+        * To make the error messages more user friendly, read the boot logs 
from the temp log file and
+        * throw an exception directly.
+        */
+       private StageBundleFactory createStageBundleFactory() throws Exception {
+               try {
+                       return 
jobBundleFactory.forStage(createExecutableStage());
+               } catch (Exception e) {
+                       byte[] output =
+                               Files.readAllBytes(
+                                       new 
File(((ProcessPythonEnvironmentManager) environmentManager).getBaseDirectory()
 
 Review comment:
   Currently, the instance is always a `ProcessPythonEnvironmentManager`. How 
about adding a `getBootLog` method into the interface, so that different 
`PythonEnvironmentManager` gets logs accordingly.  

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