Skip to content
Snippets Groups Projects
Commit bbaa9d7d authored by Matei Zaharia's avatar Matei Zaharia
Browse files

Add banner to PySpark and make wordcount output nicer

parent 12495ec6
No related branches found
No related tags found
No related merge requests found
......@@ -32,4 +32,4 @@ if __name__ == "__main__":
.reduceByKey(add)
output = counts.collect()
for (word, count) in output:
print "%s : %i" % (word, count)
print "%s: %i" % (word, count)
......@@ -21,6 +21,7 @@ An interactive shell.
This file is designed to be launched as a PYTHONSTARTUP script.
"""
import os
import platform
import pyspark
from pyspark.context import SparkContext
......@@ -28,6 +29,18 @@ from pyspark.context import SparkContext
add_files = os.environ.get("ADD_FILES").split(',') if os.environ.get("ADD_FILES") != None else None
sc = SparkContext(os.environ.get("MASTER", "local"), "PySparkShell", pyFiles=add_files)
print """Welcome to
____ __
/ __/__ ___ _____/ /__
_\ \/ _ \/ _ `/ __/ '_/
/__ / .__/\_,_/_/ /_/\_\ version 0.8.0
/_/
"""
print "Using Python version %s (%s, %s)" % (
platform.python_version(),
platform.python_build()[0],
platform.python_build()[1])
print "Spark context avaiable as sc."
if add_files != None:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment