Reputation: 4373
I m have recently updated my spark version from 1.5 to 2.0.1. By python scripts stops working.
code in 1.5 which was working
sc=SparkContext(appName="YOGI")
Code modified in spark 2.0.1
sc =SparkContext().master("spark://107.110.74.58:7077").appName("Python Spark SQL basic example").getOrCreate()
File "/home/yogendra.s/codebase/processRawData.py", line 56, in <module>
sc =SparkContext().master("spark://107.110.74.58:7077").appName("Python Spark SQL basic example").getOrCreate()
File "/home/yogendra.s/.spark_update/spark_hadoop2_7/python/lib/pyspark.zip/pyspark/context.py", line 115, in __init__
File "/home/yogendra.s/.spark_update/spark_hadoop2_7/python/lib/pyspark.zip/pyspark/context.py", line 174, in _do_init
File "/home/yogendra.s/.spark_update/spark_hadoop2_7/python/lib/pyspark.zip/pyspark/accumulators.py", line 259, in _start_update_server
File "/usr/lib/python2.7/SocketServer.py", line 420, in __init__
self.server_bind()
File "/usr/lib/python2.7/SocketServer.py", line 434, in server_bind
self.socket.bind(self.server_address)
File "/usr/lib/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
socket.gaierror: [Errno -2] Name or service not known
Content of my default.xml
spark.master spark://107.110.74.58:7077
spark.driver.memory 20g
spark.executor.memory 20g
Upvotes: 0
Views: 337
Reputation: 10450
Reviewing your code:
sc = SparkContext().master("spark://107.110.74.58:7077").appName("Python Spark SQL basic example").getOrCreate()
You should try using .setMaster
instead of .master
Spark documents suggest:
conf = SparkConf().setAppName(appName).setMaster(master)
sc = SparkContext(conf=conf)
In your case try:
from pyspark import SparkContext, SparkConf
conf = SparkConf().setAppName("Python Spark SQL basic example").setMaster("spark://107.110.74.58:7077")
sc = SparkContext(conf=conf)
Note that I've removed the .getOrCreate()
part
Upvotes: 1