Skip to content

Commit ae450e8

Browse files
committed
Skip on pypy
1 parent 6a3f59a commit ae450e8

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

python/pyspark/java_gateway.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import shlex
2727
import socket
2828
import platform
29+
import warnings
2930
from subprocess import Popen, PIPE
3031
from 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:

python/pyspark/standalone_tests.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,16 @@
3434
if __name__ == "__main__":
3535
gateway_already_started = "PYSPARK_GATEWAY_PORT" in os.environ
3636
try:
37-
if not gateway_already_started:
37+
if not gateway_already_started and not hasattr(sys, "pypy_translation_info"):
3838
print("Running redirection tests since not in existing gateway")
3939
_old_stdout = sys.stdout
4040
_old_stderr = sys.stderr
4141
# Verify stdout/stderr overwrite support for jupyter
4242
sys.stdout = new_stdout = StringIO()
4343
sys.stderr = new_stderr = StringIO()
4444
print("Redirected to {0} / {1}".format(sys.stdout, sys.stderr), file=_old_stdout)
45+
elif hasattr(sys, "pypy_translation_info"):
46+
print("Skipping redirection tests in pypy")
4547
else:
4648
print("Skipping redirection tests since gateway already exists")
4749

0 commit comments

Comments
 (0)