Github user markhamstra commented on a diff in the pull request:

    https://github.com/apache/spark/pull/1561#discussion_r15328773
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/DAGScheduler.scala 
---
    @@ -992,13 +974,14 @@ class DAGScheduler(
       }
     
       private[scheduler] def handleStageCancellation(stageId: Int) {
    -    if (stageIdToJobIds.contains(stageId)) {
    -      val jobsThatUseStage: Array[Int] = stageIdToJobIds(stageId).toArray
    -      jobsThatUseStage.foreach(jobId => {
    -        handleJobCancellation(jobId, "because Stage %s was 
cancelled".format(stageId))
    -      })
    -    } else {
    -      logInfo("No active jobs to kill for Stage " + stageId)
    +    stageIdToStage.get(stageId) match {
    +      case Some(stage) =>
    +        val jobsThatUseStage: Array[Int] = stage.jobIds.toArray
    +        jobsThatUseStage.foreach(jobId => {
    +          handleJobCancellation(jobId, "because Stage %s was 
cancelled".format(stageId))
    +        })
    --- End diff --
    
    ```scala
    jobsThatUseStage.foreach { jobId => 
      handleJobCancellation(jobId, "because Stage %s was 
cancelled".format(stageId))
    }
    ```
    There are also opportunities throughout to switch from concatenated or 
formatted strings to string interpolation, which I favor.


---
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.
---

Reply via email to