Skip to content

Commit e96a7a0

Browse files
committed
Distinguish between unexpected output and no output at all
1 parent c1ba4cd commit e96a7a0

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

python/pyspark/java_gateway.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,18 @@ def preexec_func():
5454
gateway_port = proc.stdout.readline()
5555
gateway_port = int(gateway_port)
5656
except ValueError:
57+
# Grab the remaining lines of stdout
5758
(stdout, _) = proc.communicate()
5859
exit_code = proc.poll()
5960
error_msg = "Launching GatewayServer failed"
6061
error_msg += " with exit code %d! " % exit_code if exit_code else "! "
61-
error_msg += "(Warning: unexpected output detected.)\n\n"
62-
error_msg += gateway_port + stdout
62+
if gateway_port == "" and stdout == "":
63+
error_msg += "(Warning: no output detected.)\n"
64+
else:
65+
error_msg += "(Warning: unexpected output detected.)\n\n"
66+
error_msg += "--------------------------------------------------------------\n"
67+
error_msg += gateway_port + stdout
68+
error_msg += "--------------------------------------------------------------\n"
6369
raise Exception(error_msg)
6470

6571
# Create a thread to echo output from the GatewayServer, which is required

0 commit comments

Comments
 (0)