【问题标题】:Preventing SparkListenerBus errors防止 SparkListenerBus 错误
【发布时间】:2016-10-12 17:21:38
【问题描述】:

我正在 AWS EMR 集群(EMR 5.0.0、Spark 2.0.0、30 r3.4xlarge)上运行 spark-submit 应用程序。要启动脚本,我通过 SSH 连接到主节点,然后运行以下命令:

time spark-submit --conf spark.sql.shuffle.partitions=5000 \
--conf spark.memory.storageFraction=0.3 --conf spark.memory.fraction=0.95 \
--executor-memory 8G --driver-memory 10G dataframe_script.py

应用程序使用默认的 AWS spark 配置,其中 spark.master=yarn 和 deploy-mode=client。

应用程序加载约 220GB 的数据,执行类似 SQL 的聚合,然后写入 s3。写入的数据看起来已正确处理。代码运行时,我看到一条错误消息,但代码继续运行:

ERROR LiveListenerBus: Dropping SparkListenerEvent because no remaining room in event queue. This likely means one of the SparkListeners is too slow and cannot keep up with the rate at which tasks are being started by the scheduler.

应用程序写完后,超过10分钟没有返回命令行,发出警告:

WARN ExecutorAllocationManager: No stages are running, but numRunningTasks != 0

然后有几万行的错误信息:

16/10/12 00:40:03 ERROR LiveListenerBus: SparkListenerBus has already stopped! Dropping event SparkListenerExecutorMetricsUpdate(176,WrappedArray())

进度条也在错误消息之间继续移动,例如:

[Stage 17:=================================================>   (465 + 35) / 500]

我的主要步骤的写入和结束代码:

def main():
    # some processing
    df.select(selection_list).write.json('s3path', compression=codec)
    print 'Done saving, shutting down'
    sc.stop()

有一个previous StackOverflow question,指的是this JIRA。似乎有针对旧版本 Spark 的修复程序,但我不太明白问题出在哪里。

如何避免这些错误消息?

【问题讨论】:

    标签: apache-spark pyspark spark-dataframe


    【解决方案1】:

    我想我找到了问题所在。在我的 Spark 脚本中,我在 main() 函数外部启动 SparkContext,但在 main 函数内部停止它。当脚本退出并再次尝试关闭 SparkContext 时,这会导致问题。通过将 SparkContext 初始化移到 main 函数中,这些错误中的大部分都消失了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-13
      • 2011-06-16
      • 1970-01-01
      相关资源
      最近更新 更多