【发布时间】:2019-09-25 22:48:16
【问题描述】:
我想跟踪集群中所有节点的作业/任务/阶段的全局故障率。目前的想法是解析历史服务器写入的HDFS中的日志文件并获取这些数据,但这似乎很笨拙。有没有更好的方法?理想情况下,我可以在客户端提交的每个作业中访问此信息,但情况似乎并非如此。解决此问题的推荐方法是什么?
【问题讨论】:
标签: apache-spark pyspark monitoring
我想跟踪集群中所有节点的作业/任务/阶段的全局故障率。目前的想法是解析历史服务器写入的HDFS中的日志文件并获取这些数据,但这似乎很笨拙。有没有更好的方法?理想情况下,我可以在客户端提交的每个作业中访问此信息,但情况似乎并非如此。解决此问题的推荐方法是什么?
【问题讨论】:
标签: apache-spark pyspark monitoring
一个想法是扩展 SparkListener 并将有关故障的指标收集到您想要的任何位置(例如,将事件推送到 ELK)。
一些有用的事件:
case class SparkListenerExecutorBlacklisted(
time: Long,
executorId: String,
taskFailures: Int)
extends SparkListenerEvent
case class SparkListenerExecutorBlacklistedForStage(
time: Long,
executorId: String,
taskFailures: Int,
stageId: Int,
stageAttemptId: Int)
extends SparkListenerEvent
case class SparkListenerNodeBlacklistedForStage(
time: Long,
hostId: String,
executorFailures: Int,
stageId: Int,
stageAttemptId: Int)
extends SparkListenerEvent
case class SparkListenerNodeBlacklisted(
time: Long,
hostId: String,
executorFailures: Int)
extends SparkListenerEvent
和听众:
def onExecutorBlacklisted(executorBlacklisted: SparkListenerExecutorBlacklisted): Unit
def onExecutorBlacklistedForStage(executorBlacklistedForStage: SparkListenerExecutorBlacklistedForStage): Unit
def onNodeBlacklistedForStage(nodeBlacklistedForStage: SparkListenerNodeBlacklistedForStage): Unit
def onNodeBlacklisted(nodeBlacklisted: SparkListenerNodeBlacklisted): Unit
请注意,您可以通过 Spark 上下文的 addSparkListener 订阅侦听器。其他 Stack Overflow 线程中的更多详细信息:How to implement custom job listener/tracker in Spark?
注意:要使其与 PySpark 一起使用,请按照另一个 Stack Overflow 线程中描述的步骤操作:How to add a SparkListener from pySpark in Python?
【讨论】: