Skip to content

Commit 33a2bab

Browse files
committed
Log a warning if we are running in a notebook in PyPy and we want to redirect the output
1 parent ae450e8 commit 33a2bab

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

python/pyspark/java_gateway.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,18 @@ def launch_gateway(conf=None):
5151
grab_jvm_output = (sys.stdout != sys.__stdout__ and
5252
sys.stdout.__class__.__name__ in redirect_shells)
5353

54+
if hasattr(sys, "pypy_translation_info") and grab_jvm_output:
55+
warnings.warn(
56+
"Unable to grab JVM output with PyPy."
57+
"JVM log messages may not be delivered to the notebook.")
58+
grab_jvm_putput = False
59+
5460
if "PYSPARK_GATEWAY_PORT" in os.environ:
5561
gateway_port = int(os.environ["PYSPARK_GATEWAY_PORT"])
5662
if grab_jvm_output:
5763
warnings.warn(
58-
"Gateway already launched, can not grab output. JVM messages may not be delivered.",
64+
"Gateway already launched, can not grab output."
65+
"JVM messages may not be delivered to the notebook.",
5966
RuntimeWarning)
6067
else:
6168
SPARK_HOME = _find_spark_home()

0 commit comments

Comments
 (0)