但是,当我尝试在spark集群上运行它时,我收到此错误:
Traceback (most recent call last): file "/root/spark/spark_test.py",line 141,in <module> conf=es_write_conf file "/root/spark/python/pyspark/rdd.py",line 1302,in saveAsNewAPIHadoopfile keyConverter,valueConverter,jconf) file "/root/spark/python/lib/py4j-0.8.2.1-src.zip/py4j/java_gateway.py",line 538,in __call__ file "/root/spark/python/lib/py4j-0.8.2.1-src.zip/py4j/protocol.py",line 300,in get_return_valuepy4j.protocol.Py4JJavaError: An error occurred while calling z:org.apache.spark.API.python.PythonRDD.saveAsNewAPIHadoopfile.: java.lang.classNotFoundException: org.elasticsearch.hadoop.mr.linkedMapWritable at java.net.urlclassloader.run(urlclassloader.java:366) at java.net.urlclassloader.run(urlclassloader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.urlclassloader.findClass(urlclassloader.java:354) at java.lang.classLoader.loadClass(ClassLoader.java:425) at java.lang.classLoader.loadClass(ClassLoader.java:358) at java.lang.class.forname0(Native Method) at java.lang.class.forname(Class.java:274) at org.apache.spark.util.Utils$.classForname(Utils.scala:157) at org.apache.spark.API.python.PythonRDD$$anonfun$getkeyvalueTypes$$anonfun$apply.apply(PythonRDD.scala:611) at org.apache.spark.API.python.PythonRDD$$anonfun$getkeyvalueTypes$$anonfun$apply.apply(PythonRDD.scala:610) at scala.Option.map(Option.scala:145) at org.apache.spark.API.python.PythonRDD$$anonfun$getkeyvalueTypes.apply(PythonRDD.scala:610) at org.apache.spark.API.python.PythonRDD$$anonfun$getkeyvalueTypes.apply(PythonRDD.scala:609) at scala.Option.flatMap(Option.scala:170) at org.apache.spark.API.python.PythonRDD$.getkeyvalueTypes(PythonRDD.scala:609) at org.apache.spark.API.python.PythonRDD$.saveAsNewAPIHadoopfile(PythonRDD.scala:701) at org.apache.spark.API.python.PythonRDD.saveAsNewAPIHadoopfile(PythonRDD.scala) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:231) at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:379) at py4j.Gateway.invoke(Gateway.java:259) at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:133) at py4j.commands.CallCommand.execute(CallCommand.java:79) at py4j.GatewayConnection.run(GatewayConnection.java:207) at java.lang.Thread.run(Thread.java:745)
对我来说这似乎很清楚:在工人身上没有d性研究 – hadoop jar;所以问题是:我如何将它与我的应用程序一起发送?我可以使用sc.addPyfile作为python依赖项,但它不适用于jar,并且使用spark-submit的–jars参数也无济于事.
解决方法 –jars正常工作;问题是我如何首先运行火花提交工作;正确的执行方式是:./bin/spark-submit <options> scriptname
因此,必须在脚本之前放置–jars选项:
./bin/spark-submit --jars /path/to/my.jar myscript.py
如果您认为这是将参数传递给脚本本身的唯一方法,那么这很明显,因为脚本名称后面的所有内容都将用作脚本的输入参数:
./bin/spark-submit --jars /path/to/my.jar myscript.py --do-magic=true总结
以上是内存溢出为你收集整理的python – pyspark:使用spark-submit运送jar依赖项全部内容,希望文章能够帮你解决python – pyspark:使用spark-submit运送jar依赖项所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)