aboutsummaryrefslogblamecommitdiff
path: root/python/pyspark/shell.py
blob: 54ff1bf8e7c3ea63db72a5bd9015e26705948b9d (plain) (tree)
1
2
3
4
5
6
7
8
9
10

                     
 
                                                               

         
              


                                        

                                                                    
 



                                                                               
                            
"""
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)