0
votes

I am able to submit org.apache.spark.examples.SparkPi example jar on spark submit yarn-cluster mode and it succeeds, however below snippet in pyspark fails with maximum recursion depth exceeded error.

spark-submit --master yarn --deploy-mode cluster --executor-memory 1G --num-executors 4 --conf spark.yarn.appMasterEnv.PYSPARK_PYTHON="/usr/bin/python2.7" test.py --verbose

I added pyspark_python env as per suggestion from Pyspark on yarn-cluster mode

test.py

from pyspark import SparkContext
from pyspark.sql import HiveContext

sc_new = SparkContext()
SQLContext = HiveContext(sc_new)
SQLContext.setConf("spark.sql.hive.convertMetastoreOrc", "false")
txt = SQLContext.sql( "SELECT 1")
txt.show(2000000, False)

How to fix this?

File "/hdfs/data_06/yarn/nm/usercache/<alias>/appcache/application_1583989737267_1123855/container_e59_1583989737267_1123855_01_000001/py4j-0.9-src.zip/py4j/java_gateway.py", line 746, in send_command
                   raise Py4JError("Answer from Java side is empty")
               Py4JError: Answer from Java side is empty
               ERROR:py4j.java_gateway:Error while sending or receiving.
               Traceback (most recent call last):File "/hdfs/data_10/yarn/nm/usercache/<alias>/appcache/application_1583989737267_1123601/container_e59_1583989737267_1123601_01_000001/py4j-0.9-src.zip/py4j/java_gateway.py", line 626, in send_command
File "/hdfs/data_10/yarn/nm/usercache/<alias>/appcache/application_1583989737267_1123601/container_e59_1583989737267_1123601_01_000001/py4j-0.9-src.zip/py4j/java_gateway.py", line 749, in send_command
File "/usr/lib64/python2.7/logging/__init__.py", line 1182, in exception
  self.error(msg, *args, **kwargs)
File "/usr/lib64/python2.7/logging/__init__.py", line 1175, in error
  self._log(ERROR, msg, args, **kwargs)
File "/usr/lib64/python2.7/logging/__init__.py", line 1268, in _log
  self.handle(record)
File "/usr/lib64/python2.7/logging/__init__.py", line 1278, in handle
  self.callHandlers(record)
File "/usr/lib64/python2.7/logging/__init__.py", line 1318, in callHandlers
  hdlr.handle(record)
File "/usr/lib64/python2.7/logging/__init__.py", line 749, in handle
  self.emit(record)
File "/usr/lib64/python2.7/logging/__init__.py", line 879, in emit
  self.handleError(record)
File "/usr/lib64/python2.7/logging/__init__.py", line 802, in handleError
  None, sys.stderr)
File "/usr/lib64/python2.7/traceback.py", line 125, in print_exception
  print_tb(tb, limit, file)
File "/usr/lib64/python2.7/traceback.py", line 69, in print_tb
  line = linecache.getline(filename, lineno, f.f_globals)
File "/usr/lib64/python2.7/linecache.py", line 14, in getline
  lines = getlines(filename, module_globals)
File "/usr/lib64/python2.7/linecache.py", line 40, in getlines
  return updatecache(filename, module_globals)
File "/usr/lib64/python2.7/linecache.py", line 128, in updatecache
  lines = fp.readlines()
RuntimeError: maximum recursion depth exceeded while calling a Python object
  • Running Spark version 1.6.0
  • hive, version 1.1.0
  • Hadoop version:2.6.0-cdh5.13.0
1

1 Answers

0
votes

by calling txt.show(2000000, False) you are making py4j to make to-and-fro jvm-python-object-jvm call where your result does not have those many rows. I believe max you can call in show() is 2000-ish. Why you need to show 2000000 records when all you are doing is SELECT 1 ?