diff options
Diffstat (limited to 'python/pyspark/shell.py')
-rw-r--r-- | python/pyspark/shell.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/python/pyspark/shell.py b/python/pyspark/shell.py new file mode 100644 index 0000000000..54ff1bf8e7 --- /dev/null +++ b/python/pyspark/shell.py @@ -0,0 +1,18 @@ +""" +An interactive shell. + +This file is designed to be launched as a PYTHONSTARTUP script. +""" +import os +import pyspark +from pyspark.context import SparkContext + + +sc = SparkContext(os.environ.get("MASTER", "local"), "PySparkShell") +print "Spark context avaiable as sc." + +# The ./pyspark script stores the old PYTHONSTARTUP value in OLD_PYTHONSTARTUP, +# which allows us to execute the user's PYTHONSTARTUP file: +_pythonstartup = os.environ.get('OLD_PYTHONSTARTUP') +if _pythonstartup and os.path.isfile(_pythonstartup): + execfile(_pythonstartup) |