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.
|
2013-01-02 00:25:49 -05:00
|
|
|
"""
|
|
|
|
import os
|
2012-10-19 20:16:41 -04:00
|
|
|
from pyspark.context import SparkContext
|
|
|
|
|
|
|
|
|
2013-01-02 00:25:49 -05:00
|
|
|
sc = SparkContext(os.environ.get("MASTER", "local"), "PySparkShell")
|
|
|
|
print "Spark context avaiable as sc."
|
2012-10-19 20:16:41 -04:00
|
|
|
|
2013-01-02 00:25:49 -05: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)
|