Github user andrewor14 commented on a diff in the pull request:
https://github.com/apache/spark/pull/5306#discussion_r27713951
--- Diff: core/src/main/scala/org/apache/spark/HeartbeatReceiver.scala ---
@@ -71,12 +75,22 @@ private[spark] class HeartbeatReceiver(sc:
SparkContext, scheduler: TaskSchedule
}
override def receiveWithLogging: PartialFunction[Any, Unit] = {
- case Heartbeat(executorId, taskMetrics, blockManagerId) =>
- val unknownExecutor = !scheduler.executorHeartbeatReceived(
- executorId, taskMetrics, blockManagerId)
- val response = HeartbeatResponse(reregisterBlockManager =
unknownExecutor)
- executorLastSeen(executorId) = System.currentTimeMillis()
- sender ! response
+ case RegisterTaskScheduler(scheduler) =>
+ this.scheduler = scheduler
+ case heartbeat @ Heartbeat(executorId, taskMetrics, blockManagerId) =>
+ if (scheduler != null) {
+ val unknownExecutor = !scheduler.executorHeartbeatReceived(
+ executorId, taskMetrics, blockManagerId)
+ val response = HeartbeatResponse(reregisterBlockManager =
unknownExecutor)
+ executorLastSeen(executorId) = System.currentTimeMillis()
+ sender ! response
+ } else {
+ // Because Executor will sleep several seconds then send the first
"Heartbeat", this case
+ // rarely happens. However, if it really happens, log it and ask
the executor to register
+ // itself again.
+ logWarning(s"Dropping $heartbeat because TaskScheduler has not
been ready yet")
--- End diff --
is not ready yet
---
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.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]