You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2020/01/17 09:21:51 UTC

[GitHub] [flink] dianfu 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

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

 ##########
 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()
+						+ "/flink-python-udf-boot.log").toPath());
 
 Review comment:
   What about changing `/flink-python-udf-boot.log` to `File.separator + "flink-python-udf-boot.log`?

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


With regards,
Apache Git Services