Execute python script with spark

Viewed 489

I want to pass a python test into SparkContext within my jupyter notebook and have the output shown in the notebook as well. To test, I'm simply executing my jupyter notebook like so:

sparkConf = SparkConf()
sc = SparkContext(conf=sparkConf)

sc.addPyFile('test.py')

With test.py looking like

rdd = sc.parallelize(range(100000000))
print(rdd.sum())

But when I execute the sc.addPyFile line in my notebook, I do not see the output. Am I passing the pyspark script into my SparkContext incorrectly?

1 Answers
Related