gpt4 book ai didi

apache-spark - 警告 cluster.YarnScheduler : Initial job has not accepted any resources

转载 作者:行者123 更新时间:2023-12-03 14:26:57 25 4
gpt4 key购买 nike

我运行的任何 Spark 作业都将失败并显示以下错误消息

17/06/16 11:10:43 WARN cluster.YarnScheduler: Initial job has not accepted any resources; check your cluster UI to ensure that workers are registered and have sufficient resources



Spark 版本是 1.6,在 Yarn 上运行。

我正在从 pyspark 发布工作。

您可以从作业时间表中注意到它无限期地运行并且没有添加或删除资源。 1

最佳答案

第一点是,如果有足够的资源,例如节点、CPU 和内存可用于 yarn ,它可以使用动态分配来创建具有适当默认内核和内存分配的 Spark 工作线程。

就我而言,我需要关闭动态分配,因为我的资源水平非常低。

所以从pyspark我设置了以下值:

conf = (SparkConf().setAppName("simple")
.set("spark.shuffle.service.enabled", "false")
.set("spark.dynamicAllocation.enabled", "false")
.set("spark.cores.max", "1")
.set("spark.executor.instances","2")
.set("spark.executor.memory","200m")
.set("spark.executor.cores","1")

注意:基本上这里设置的值应该小于实际可用资源。但是,此处的值太小可能会导致内存不足问题,或者在您的作业运行时出现性能下降问题。

The complete code gist of a sample job is available here

对于这个 pyspark 案例需要注意的另一个重要点是 Spark on Yarn 可以在两种模式下运行
  • 集群模式——spark驱动运行在spark主节点
  • 客户端模式 - Spark 驱动程序从运行交互式 shell 的客户端运行。

  • 集群模式不太适合以交互方式使用 Spark。需要用户输入的 Spark 应用程序(例如 spark-shell 和 pyspark)需要 Spark 驱动程序在启动 Spark 应用程序的客户端进程内运行。

    客户端模式可以在环境中设置如下 export PYSPARK_SUBMIT_ARGS='--master yarn --deploy-mode client pyspark-shell'

    关于apache-spark - 警告 cluster.YarnScheduler : Initial job has not accepted any resources,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44581585/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com