ezoic

Wednesday, March 28, 2018

How I set up a pyspark job.

I installed spark on a ubuntu.

I wrote a pyspark hello world python script:

from pyspark import SparkContext
from operator import add

sc = SparkContext()
data = sc.parallelize(list("Hello World"))
counts = data.map(lambda x: (x, 1)).reduceByKey(add).sortBy(lambda x: x[1], ascending=False).collect()
for (word, count) in counts:
    print("{}: {}".format(word, count))
sc.stop()


And I wrote a sh file to run the pyspark code:

/home/ubuntu/spark/bin/spark-submit --master local[8] --driver-memory 12g --executor-memory 12g helloworld.py


And I run it. Got the results:



1 comment:

  1. Toto locations where you can use Sports Toto Security are selected by site experts based on a comparison of capabilities, security, and features. We recommend the use of Private Toto in parks where there is strong evidence. 토토사이트 this website 안전놀이터

    ReplyDelete

looking for a man

 I am a mid aged woman. I live in southern california.  I was born in 1980. I do not have any kid. no compliacted dating.  I am looking for ...