Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spark: Executing the python kinesis streaming example

I'm (very) new to spark, so apologies if this is a stupid question.

I am trying to execute the spark (2.2.0) python spark streaming example, however I keep running into the issue below:

Traceback (most recent call last):
  File "/Users/rmanoch/Downloads/spark-2.2.0-bin-hadoop2.7/kinesis_wordcount_asl.py", line 76, in <module>
    ssc, appName, streamName, endpointUrl, regionName, InitialPositionInStream.LATEST, 2)
  File "/Users/rmanoch/Downloads/spark-2.2.0-bin-hadoop2.7/python/lib/pyspark.zip/pyspark/streaming/kinesis.py", line 92, in createStream
  File "/Users/rmanoch/Downloads/spark-2.2.0-bin-hadoop2.7/python/lib/py4j-0.10.4-src.zip/py4j/java_gateway.py", line 1133, in __call__
  File "/Users/rmanoch/Downloads/spark-2.2.0-bin-hadoop2.7/python/lib/py4j-0.10.4-src.zip/py4j/protocol.py", line 323, in get_return_value
py4j.protocol.Py4JError: An error occurred while calling o27.createStream. Trace:
py4j.Py4JException: Method createStream([class org.apache.spark.streaming.api.java.JavaStreamingContext, class java.lang.String, class java.lang.String, class java.lang.String, class java.lang.String, class java.lang.Integer, class org.apache.spark.streaming.Duration, class org.apache.spark.storage.StorageLevel, null, null, null, null, null]) does not exist
        at py4j.reflection.ReflectionEngine.getMethod(ReflectionEngine.java:318)
        at py4j.reflection.ReflectionEngine.getMethod(ReflectionEngine.java:326)
        at py4j.Gateway.invoke(Gateway.java:272)
        at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
        at py4j.commands.CallCommand.execute(CallCommand.java:79)
        at py4j.GatewayConnection.run(GatewayConnection.java:214)
        at java.lang.Thread.run(Thread.java:745)

The tarball I downloaded from spark's website did not include the external folder in it (seems like there's some license issue), so this is the command I have been trying to execute (after downloading kinesis_wordcount_asl.py from github)

bin/spark-submit --packages org.apache.spark:spark-streaming-kinesis-asl_2.11:2.2.0 kinesis_wordcount_asl.py sparkEnrichedDev relay-enriched-dev https://kinesis.us-west-2.amazonaws.com us-west-2

Happy to provide any additional details if needed.

like image 703
Rishabh Manocha Avatar asked Oct 18 '22 06:10

Rishabh Manocha


1 Answers

Based on the exception it looks like there is a version mismatch between core Spark / Spark streaming and spark-kinesis. API changed between Spark 2.1 and 2.2 (SPARK-19405) and version mismatch would cause a similar error.

This makes me think you're submitting using incorrect binaries (just a guess) - it can be PATH, PYTHONPATH or SPARK_HOME issue if you use local mode. Because you get signature mismatch we can assume that spark-kinesis is loaded correctly and org.apache.spark.streaming.kinesis.KinesisUtilsPythonHelper is present on the CLASSPATH.

like image 150
Alper t. Turker Avatar answered Oct 20 '22 23:10

Alper t. Turker