spark-instrumented-optimizer/python/pyspark/shell.py

18 lines
532 B
Python
Raw Normal View History

2012-10-19 20:16:41 -04:00
"""
An interactive shell.
2013-01-20 04:57:44 -05:00
This file is designed to be launched as a PYTHONSTARTUP script.
"""
import os
2012-10-19 20:16:41 -04:00
from pyspark.context import SparkContext
sc = SparkContext(os.environ.get("MASTER", "local"), "PySparkShell")
print "Spark context avaiable as sc."
2012-10-19 20:16:41 -04:00
# 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):
2013-01-20 04:57:44 -05:00
execfile(_pythonstartup)