tgravescs commented on a change in pull request #27050: [SPARK-30388][Core] 
Mark running map stages of finished job as finished, and cancel running tasks
URL: https://github.com/apache/spark/pull/27050#discussion_r366598274
 
 

 ##########
 File path: core/src/main/scala/org/apache/spark/scheduler/DAGScheduler.scala
 ##########
 @@ -1431,21 +1434,28 @@ private[spark] class DAGScheduler(
                   // If the whole job has finished, remove it
                   if (job.numFinished == job.numPartitions) {
                     markStageAsFinished(resultStage)
-                    cleanupStateForJobAndIndependentStages(job)
-                    try {
-                      // killAllTaskAttempts will fail if a SchedulerBackend 
does not implement
-                      // killTask.
-                      logInfo(s"Job ${job.jobId} is finished. Cancelling 
potential speculative " +
-                        "or zombie tasks for this job")
-                      // ResultStage is only used by this job. It's safe to 
kill speculative or
-                      // zombie tasks in this stage.
-                      taskScheduler.killAllTaskAttempts(
-                        stageId,
-                        shouldInterruptTaskThread(job),
-                        reason = "Stage finished")
-                    } catch {
-                      case e: UnsupportedOperationException =>
-                        logWarning(s"Could not cancel tasks for stage 
$stageId", e)
+                    val removedStages = 
cleanupStateForJobAndIndependentStages(job)
+                    removedStages += resultStage
+                    val shouldInterrupt = shouldInterruptTaskThread(job)
+                    // removedStages are only used by this job. It's safe to 
kill speculative or
+                    // zombie tasks in these stages.
+                    logInfo(s"Job ${job.jobId} is finished. Cancelling 
potential speculative " +
+                      "or zombie tasks for this job")
+                    removedStages.foreach { stage =>
+                      try {
+                        // killAllTaskAttempts will fail if a SchedulerBackend 
does not implement
+                        // killTask.
+                        if (stage == resultStage) {
 
 Review comment:
   seems like you should just separate this out because you are first adding it 
to the hashSEt and then special casing it. Just do removedStages.foreach 
without the resultSTage and after the loop do resultSTage

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to