diff options
author | Matthew Farrellee <matt@redhat.com> | 2014-09-03 19:37:37 -0700 |
---|---|---|
committer | Josh Rosen <joshrosen@apache.org> | 2014-09-03 19:37:37 -0700 |
commit | 7c6e71f05f4f5e0cd2d038ee81d1cda4a3e5cb39 (patch) | |
tree | bf9287ec799e881bb117fb21af8b809ad38a34f6 /python | |
parent | c5cbc49233193836b321cb6b77ce69dae798570b (diff) | |
download | spark-7c6e71f05f4f5e0cd2d038ee81d1cda4a3e5cb39.tar.gz spark-7c6e71f05f4f5e0cd2d038ee81d1cda4a3e5cb39.tar.bz2 spark-7c6e71f05f4f5e0cd2d038ee81d1cda4a3e5cb39.zip |
[SPARK-2435] Add shutdown hook to pyspark
Author: Matthew Farrellee <matt@redhat.com>
Closes #2183 from mattf/SPARK-2435 and squashes the following commits:
ee0ee99 [Matthew Farrellee] [SPARK-2435] Add shutdown hook to pyspark
Diffstat (limited to 'python')
-rw-r--r-- | python/pyspark/shell.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/python/pyspark/shell.py b/python/pyspark/shell.py index e1e7cd9541..fde3c29e5e 100644 --- a/python/pyspark/shell.py +++ b/python/pyspark/shell.py @@ -28,6 +28,7 @@ if sys.version_info[0] != 2: sys.exit(1) +import atexit import os import platform import pyspark @@ -42,6 +43,7 @@ if os.environ.get("SPARK_EXECUTOR_URI"): SparkContext.setSystemProperty("spark.executor.uri", os.environ["SPARK_EXECUTOR_URI"]) sc = SparkContext(appName="PySparkShell", pyFiles=add_files) +atexit.register(lambda: sc.stop()) print("""Welcome to ____ __ |