aboutsummaryrefslogtreecommitdiff
path: root/python/pyspark
diff options
context:
space:
mode:
authorMatei Zaharia <matei.zaharia@gmail.com>2013-08-31 13:18:12 -0700
committerMatei Zaharia <matei.zaharia@gmail.com>2013-08-31 13:18:12 -0700
commitfd89835965bf52efb1a0e8ebe253643b89fc463a (patch)
tree15c998c4b4a2d256a69f448fd5ed14c2895ced46 /python/pyspark
parent618f0ecb43fc0b9f36df0626465999f8685b310c (diff)
parent742c44eae693d2bde76259043c962e416691258c (diff)
downloadspark-fd89835965bf52efb1a0e8ebe253643b89fc463a.tar.gz
spark-fd89835965bf52efb1a0e8ebe253643b89fc463a.tar.bz2
spark-fd89835965bf52efb1a0e8ebe253643b89fc463a.zip
Merge pull request #870 from JoshRosen/spark-885
Don't send SIGINT / ctrl-c to Py4J gateway subprocess
Diffstat (limited to 'python/pyspark')
-rw-r--r--python/pyspark/java_gateway.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/python/pyspark/java_gateway.py b/python/pyspark/java_gateway.py
index 18011c0dc9..3ccf062c86 100644
--- a/python/pyspark/java_gateway.py
+++ b/python/pyspark/java_gateway.py
@@ -17,6 +17,7 @@
import os
import sys
+import signal
from subprocess import Popen, PIPE
from threading import Thread
from py4j.java_gateway import java_import, JavaGateway, GatewayClient
@@ -30,7 +31,10 @@ def launch_gateway():
# proper classpath and SPARK_MEM settings from spark-env.sh
command = [os.path.join(SPARK_HOME, "spark-class"), "py4j.GatewayServer",
"--die-on-broken-pipe", "0"]
- proc = Popen(command, stdout=PIPE, stdin=PIPE)
+ # Don't send ctrl-c / SIGINT to the Java gateway:
+ def preexec_function():
+ signal.signal(signal.SIGINT, signal.SIG_IGN)
+ proc = Popen(command, stdout=PIPE, stdin=PIPE, preexec_fn=preexec_function)
# Determine which ephemeral port the server started on:
port = int(proc.stdout.readline())
# Create a thread to echo output from the GatewayServer, which is required