spark core 2.0 Executor Heartbeat
来源:互联网 发布:校园网网络拓扑结构图 编辑:程序博客网 时间:2024/05/22 09:48
Executor heartbeat 调度一个任务向driver汇报心跳和部分度量信息
/** * Schedules a task to report heartbeat and partial metrics for active tasks to driver. */ private def startDriverHeartbeater(): Unit = { val intervalMs = conf.getTimeAsMs("spark.executor.heartbeatInterval", "10s") // Wait a random interval so the heartbeats don't end up in sync val initialDelay = intervalMs + (math.random * intervalMs).asInstanceOf[Int] val heartbeatTask = new Runnable() { override def run(): Unit = Utils.logUncaughtExceptions(reportHeartBeat()) } heartbeater.scheduleAtFixedRate(heartbeatTask, initialDelay, intervalMs, TimeUnit.MILLISECONDS) }}
heartbeater是一个后台周期性的执行器。周期性的调用heartbeatTask这个任务。
private val heartbeater = ThreadUtils.newDaemonSingleThreadScheduledExecutor("driver-heartbeater")
heartbeatTask仅调用reportHeartBeat方法,如下
/** Reports heartbeat and metrics for active tasks to the driver. */ private def reportHeartBeat(): Unit = { // list of (task id, accumUpdates) to send back to the driver val accumUpdates = new ArrayBuffer[(Long, Seq[AccumulatorV2[_, _]])]() val curGCTime = computeTotalGcTime() for (taskRunner <- runningTasks.values().asScala) { if (taskRunner.task != null) { taskRunner.task.metrics.mergeShuffleReadMetrics() taskRunner.task.metrics.setJvmGCTime(curGCTime - taskRunner.startGCTime) accumUpdates += ((taskRunner.taskId, taskRunner.task.metrics.accumulators())) } } val message = Heartbeat(executorId, accumUpdates.toArray, env.blockManager.blockManagerId) try { val response = heartbeatReceiverRef.askWithRetry[HeartbeatResponse]( message, RpcTimeout(conf, "spark.executor.heartbeatInterval", "10s")) if (response.reregisterBlockManager) { logInfo("Told to re-register on heartbeat") env.blockManager.reregister() } heartbeatFailures = 0 } catch { case NonFatal(e) => logWarning("Issue communicating with driver in heartbeater", e) heartbeatFailures += 1 if (heartbeatFailures >= HEARTBEAT_MAX_FAILURES) { logError(s"Exit as unable to send heartbeats to driver " + s"more than $HEARTBEAT_MAX_FAILURES times") System.exit(ExecutorExitCode.HEARTBEAT_FAILURE) } } }
0 0
- spark core 2.0 Executor Heartbeat
- spark core 2.0 Executor
- spark core 2.0 Executor ClassLoader
- spark core源码分析7 Executor的运行
- 【Spark】worker、executor、core、stage、task、partition概念
- Spark-executor
- Spark Executor
- spark executor
- spark 1.6.0 core源码分析7 Spark executor的运行
- spark core 2.0 SortShuffleManager
- spark core 2.0 OutputCommitCoordinator
- spark core 2.0 LiveListenerBus
- spark core 2.0 JobProgressListener
- spark core 2.0 YarnClusterManager
- spark core 2.0 YarnClusterSchedulerBackend
- spark core 2.0 MetricsConfig
- spark core 2.0 ContextCleaner
- spark core 2.0 TransportClientFactory
- 怎么样虚拟化一个串口
- 拼接SQL常见错误
- 设计模式:组合模式-composite
- MYSQL错误 NO.1130 ERROR的解决(使用客户端远程连接数据库)
- emacs cask
- spark core 2.0 Executor Heartbeat
- Redis和jedis
- linux 自动清理 Tomcat 日志文件
- 五大原则让你的代码不再受bug的困扰
- 【PAT】1002. A+B for Polynomials(25)
- LVS四种负载均衡类型,十种调度方法
- 加载中的动画(网络请求)
- UpdateWindow
- python实现去掉文本中的某种特定字符如1、