【问题标题】:External dependency for spark job火花作业的外部依赖
【发布时间】:2018-05-25 17:55:01
【问题描述】:

我是大数据技术的新手。我必须在 EMR 上以集群模式运行 spark 作业。这项工作是用 python 编写的,它依赖于几个库和一些其他工具。我已经编写了脚本并在本地客户端模式下运行它。但是当我尝试使用 yarn 运行它时会出现一些依赖问题。如何管理这些依赖关系?

日志:

"/mnt/yarn/usercache/hadoop/appcache/application_1511680510570_0144/container_1511680510570_0144_01_000002/pyspark.zip/pyspark/cloudpickle.py", line 711, in subimport
    __import__(name)
ImportError: ('No module named boto3', <function subimport at 0x7f8c3c4f9c80>, ('boto3',))

        at org.apache.spark.api.python.PythonRunner$$anon$1.read(PythonRDD.scala:193)
        at org.apache.spark.api.python.PythonRunner$$anon$1.<init>(PythonRDD.scala:234)
        at org.apache.spark.api.python.PythonRunner.compute(PythonRDD.scala:152)
        at org.apache.spark.api.python.PythonRDD.compute(PythonRDD.scala:63)
        at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:323)
        at org.apache.spark.rdd.RDD.iterator(RDD.scala:287)
        at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:87)
        at org.apache.spark.scheduler.Task.run(Task.scala:108)
        at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:335)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

【问题讨论】:

  • 您能在此处提供错误消息吗?
  • 我已经添加了错误信息

标签: pyspark hadoop-yarn emr


【解决方案1】:

您似乎还没有安装 Boto 3 库。 下载兼容的并使用下面的方法安装它

$ pip install boto3

python -m pip install --user boto3

希望对你有帮助。你可以参考链接-https://github.com/boto/boto3

那么您似乎还没有在所有执行程序(节点)上安装 boot 3。由于您正在运行 spark,python 代码部分在驱动程序和执行程序上运行。如果 yarn,则需要在所有节点中安装该库。

要安装相同。请参考-How to bootstrap installation of Python modules on Amazon EMR?

【讨论】:

  • 我已经安装了 boto3 并使用本地客户端模式运行作业。它工作正常。我在使用 yarn 时遇到了这个问题。
  • 所有节点上的 boto3 安装对您都有效吗?
  • 感谢您的帮助。我已经解决了这个问题。有没有办法使用 cli 在正在运行的集群上添加引导操作?
【解决方案2】:

是的,你可以-

aws emr create-cluster --bootstrap-actions Path=&lt;&gt;,Name=BootstrapAction1,Args=[arg1,arg2].. --auto-terminate.请参考下方-http://docs.aws.amazon.com/ElasticMapReduce/latest/ManagementGuide/emr-plan-bootstrap.html#bootstrapUses

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-06-01
    • 2014-12-19
    • 2019-03-14
    • 2019-12-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多