You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by jo...@apache.org on 2014/09/04 04:37:43 UTC

git commit: [SPARK-2435] Add shutdown hook to pyspark

Repository: spark
Updated Branches:
  refs/heads/master c5cbc4923 -> 7c6e71f05


[SPARK-2435] Add shutdown hook to pyspark

Author: Matthew Farrellee <ma...@redhat.com>

Closes #2183 from mattf/SPARK-2435 and squashes the following commits:

ee0ee99 [Matthew Farrellee] [SPARK-2435] Add shutdown hook to pyspark


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/7c6e71f0
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/7c6e71f0
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/7c6e71f0

Branch: refs/heads/master
Commit: 7c6e71f05f4f5e0cd2d038ee81d1cda4a3e5cb39
Parents: c5cbc49
Author: Matthew Farrellee <ma...@redhat.com>
Authored: Wed Sep 3 19:37:37 2014 -0700
Committer: Josh Rosen <jo...@apache.org>
Committed: Wed Sep 3 19:37:37 2014 -0700

----------------------------------------------------------------------
 python/pyspark/shell.py | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/7c6e71f0/python/pyspark/shell.py
----------------------------------------------------------------------
diff --git a/python/pyspark/shell.py b/python/pyspark/shell.py
index e1e7cd9..fde3c29 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
       ____              __


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org