Github user pwendell commented on a diff in the pull request:
https://github.com/apache/spark/pull/1056#discussion_r15273504
--- Diff: core/src/main/scala/org/apache/spark/executor/Executor.scala ---
@@ -348,4 +352,46 @@ private[spark] class Executor(
}
}
}
+
+ def stop() {
+ isStopped = true
+ threadPool.shutdown()
+ }
+
+ def startDriverHeartbeater() {
+ val interval = conf.getInt("spark.executor.heartbeatInterval", 2000)
+ val timeout = AkkaUtils.lookupTimeout(conf)
+ val retryAttempts = AkkaUtils.numRetries(conf)
+ val retryIntervalMs = AkkaUtils.retryWaitMs(conf)
+ val heartbeatReceiverRef =
AkkaUtils.makeDriverRef("HeartbeatReceiver", conf, env.actorSystem)
+
+ val t = new Thread() {
+ override def run() {
+ // Sleep a random interval so the heartbeats don't end up in sync
+ Thread.sleep(interval + (math.random * interval).asInstanceOf[Int])
+
+ while (!isStopped) {
+ val tasksMetrics = new ArrayBuffer[(Long, TaskMetrics)]()
+ for (taskRunner <- runningTasks.values()) {
+ Option(taskRunner.task).flatMap(_.metrics).foreach { metrics =>
+ tasksMetrics += ((taskRunner.taskId, metrics))
--- End diff --
Also it seems like now the listener and all downstream code needs to expect
`TaskMetrics` objects that have potentially null fields. For instance a
TaskMetrics object could be created and then instantly serialized before any of
the fields are populated.
A lot of the code downstream doesn't makes the assumption that TaskMetrics
will have only filled-in values. I just checked the Json serializer for
TaskMetrics and also the web UI, both of them will throw exceptions if there
are null fields here.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---