beliefer commented on a change in pull request #26510: 
[SPARK-29885][PYTHON][CORE] Improve the exception message when reading the 
daemon port
URL: https://github.com/apache/spark/pull/26510#discussion_r347718930
 
 

 ##########
 File path: 
core/src/main/scala/org/apache/spark/api/python/PythonWorkerFactory.scala
 ##########
 @@ -213,7 +213,14 @@ private[spark] class PythonWorkerFactory(pythonExec: 
String, envVars: Map[String
           daemonPort = in.readInt()
         } catch {
           case _: EOFException =>
-            throw new SparkException(s"No port number in $daemonModule's 
stdout")
+            val exceptionMessage =
+              s"EOFException occurred while reading the port number from 
$daemonModule."
+            if (daemon.isAlive) {
+              throw new SparkException(exceptionMessage)
+            } else {
+              throw new SparkException(exceptionMessage +
+                s"Python daemon has dead and exit code is: 
${daemon.exitValue}")
 
 Review comment:
   @HyukjinKwon Looks good for me. But the message "No port number" still 
causing confusion. Could I change it like:
   ```
             case _: EOFException if !daemon.isAlive =>
               throw new SparkException(
                  s"EOFException occurred while reading the port number from 
$daemonModule's" + 
                  s" stdout and terminated with code: ${daemon.exitValue}.")
             case _: EOFException =>
               throw new SparkException("EOFException occurred while reading 
the port number " +
                  s"from $daemonModule's stdout")
   ```

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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to