Github user mateiz commented on a diff in the pull request:
https://github.com/apache/spark/pull/186#discussion_r11917798
--- Diff: core/src/main/scala/org/apache/spark/scheduler/DAGScheduler.scala
---
@@ -1152,13 +1003,160 @@ class DAGScheduler(
}
def stop() {
- if (eventProcessActor != null) {
- eventProcessActor ! StopDAGScheduler
- }
+ logInfo("Stopping DAGScheduler")
+ dagSchedulerActorSupervisor ! PoisonPill
taskScheduler.stop()
}
}
+private[scheduler] class DAGSchedulerActorSupervisor(dagScheduler:
DAGScheduler)
+ extends Actor with Logging {
+
+ override val supervisorStrategy =
+ OneForOneStrategy() {
+ case x: Exception =>
+ logError("eventProcesserActor failed due to the error %s; shutting
down SparkContext"
+ .format(x.getMessage))
+ dagScheduler.doCancelAllJobs()
+ dagScheduler.sc.stop()
+ Stop
+ }
+
+ def receive = {
+ case p: Props => sender ! context.actorOf(p)
+ case _ => logWarning("received unknown message in
DAGSchedulerActorSupervisor")
+ }
+
+ dagScheduler.eventProcessActor = context.actorOf(
+ Props(new DAGSchedulerEventProcessActor(dagScheduler)))
+}
+
+private[scheduler] class DAGSchedulerEventProcessActor(dagScheduler:
DAGScheduler)
+ extends Actor with Logging {
+
+ override def preStart() {
+ // set DAGScheduler for taskScheduler to ensure eventProcessActor is
always
+ // valid when the messages arrive
+ dagScheduler.taskScheduler.setDAGScheduler(dagScheduler)
+ }
+
+ /**
+ * The main event loop of the DAG scheduler.
+ */
+ def receive = {
+ case JobSubmitted(jobId, rdd, func, partitions, allowLocal, callSite,
listener, properties) =>
--- End diff --
Move this into a method in DAGScheduler like the others. Otherwise it's
awkward that it will send log messages from DAGSchedulerEventProcessActor and
that it has to use dagScheduler in front of everything
---
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.
---