如何跨集群跟踪全局 task/job 故障率

How to track global task/job failure rate across cluster

我想跟踪集群中所有节点的 jobs/tasks/stages 的全局故障率。目前的想法是解析history server写入的HDFS中的日志文件,获取这些数据,但是这看起来很笨拙。有没有更好的方法?理想情况下,我可以根据客户端提交的每个作业访问此信息,但情况似乎并非如此。解决此问题的推荐方法是什么?

一个想法是扩展 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 线程中描述的步骤操作: