2626import shlex
2727import socket
2828import platform
29+ import warnings
2930from subprocess import Popen , PIPE
3031from threading import Thread
3132
@@ -49,13 +50,13 @@ def launch_gateway(conf=None):
4950 redirect_shells = ["ZMQInteractiveShell" , "StringIO" ]
5051 grab_jvm_output = (sys .stdout != sys .__stdout__ and
5152 sys .stdout .__class__ .__name__ in redirect_shells )
52- if grab_jvm_output :
53- print ("Grabbing JVM output cause magic....." )
5453
5554 if "PYSPARK_GATEWAY_PORT" in os .environ :
5655 gateway_port = int (os .environ ["PYSPARK_GATEWAY_PORT" ])
5756 if grab_jvm_output :
58- print ("Gateway already launched, can not grab output" )
57+ warnings .warn (
58+ "Gateway already launched, can not grab output. JVM messages may not be delivered." ,
59+ RuntimeWarning )
5960 else :
6061 SPARK_HOME = _find_spark_home ()
6162 # Launch the Py4j gateway using Spark's run command so that we pick up the
@@ -106,10 +107,8 @@ def preexec_func():
106107 def connect (input_pipe , out_pipe ):
107108 """Connect the input pipe to the output. We can't use os.dup for IPython
108109 or directly write to them (see https://github.com/ipython/ipython/pull/3072/)."""
109- print ("Connecting pipes...." )
110110 for line in iter (input_pipe .readline , b'' ):
111111 print (line , file = out_pipe )
112- print ("Pipe finished..." )
113112 input_pipe .close ()
114113
115114 if grab_jvm_output :
0 commit comments