Github user CodingCat commented on a diff in the pull request:
https://github.com/apache/spark/pull/186#discussion_r11930692
--- Diff: core/src/main/scala/org/apache/spark/scheduler/DAGScheduler.scala
---
@@ -730,6 +588,100 @@ class DAGScheduler(
}
}
+ private[scheduler] def handleJobGroupCancelled(groupId: String) {
+ // Cancel all jobs belonging to this job group.
+ // First finds all active jobs with this group id, and then kill
stages for them.
+ val activeInGroup = activeJobs.filter(activeJob =>
+ groupId == activeJob.properties.get(SparkContext.SPARK_JOB_GROUP_ID))
+ val jobIds = activeInGroup.map(_.jobId)
+ jobIds.foreach(handleJobCancellation(_, "part of cancel job group"))
+ submitWaitingStages()
+ }
+
+ private[scheduler] def handleBeginEvent(task: Task[_], taskInfo:
TaskInfo) {
+ for (stage <- stageIdToStage.get(task.stageId); stageInfo <-
stageToInfos.get(stage)) {
+ if (taskInfo.serializedSize > DAGScheduler.TASK_SIZE_TO_WARN * 1024
&&
+ !stageInfo.emittedTaskSizeWarning) {
+ stageInfo.emittedTaskSizeWarning = true
+ logWarning(("Stage %d (%s) contains a task of very large " +
+ "size (%d KB). The maximum recommended task size is %d
KB.").format(
+ task.stageId, stageInfo.name, taskInfo.serializedSize / 1024,
+ DAGScheduler.TASK_SIZE_TO_WARN))
+ }
+ }
+ listenerBus.post(SparkListenerTaskStart(task.stageId, taskInfo))
+ submitWaitingStages()
+ }
+
+ private[scheduler] def handleTaskSetFailed(taskSet: TaskSet, reason:
String) {
+ stageIdToStage.get(taskSet.stageId).foreach {abortStage(_, reason) }
+ submitWaitingStages()
+ }
+
+ private[scheduler] def cleanUpAfterSchedulerStop() {
+ for (job <- activeJobs) {
+ val error = new SparkException("Job cancelled because SparkContext
was shut down")
+ job.listener.jobFailed(error)
+ // Tell the listeners that all of the running stages have ended.
Don't bother
+ // cancelling the stages because if the DAG scheduler is stopped,
the entire application
+ // is in the process of getting stopped.
+ val stageFailedMessage = "Stage cancelled because SparkContext was
shut down"
+ runningStages.foreach { stage =>
+ val info = stageToInfos(stage)
+ info.stageFailed(stageFailedMessage)
+ listenerBus.post(SparkListenerStageCompleted(info))
+ }
+ listenerBus.post(SparkListenerJobEnd(job.jobId, JobFailed(error)))
+ }
+ }
+
+ private[scheduler] def handleGetTaskResult(taskInfo: TaskInfo) {
+ listenerBus.post(SparkListenerTaskGettingResult(taskInfo))
+ submitWaitingStages()
+ }
+
+ private[scheduler] def handleJobSubmitted(jobId: Int,
+ finalRDD: RDD[_],
+ func: (TaskContext, Iterator[_]) => _,
+ partitions: Array[Int],
+ allowLocal: Boolean,
+ callSite: String,
+ listener: JobListener,
+ properties: Properties = null) {
+ var finalStage: Stage = null
+ try {
+ // New stage creation may throw an exception if, for example, jobs
are run on a
+ // HadoopRDD whose underlying HDFS files have been deleted.
+ finalStage = newStage(finalRDD, partitions.size, None, jobId,
Some(callSite))
+ } catch {
+ case e: Exception =>
+ logWarning("Creating new stage failed due to exception - job: " +
jobId, e)
+ listener.jobFailed(e)
--- End diff --
actually the reason is also on that submitWaitingStages(), I have to make
the code go down to execute L682.....
---
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.
---