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

    https://github.com/apache/spark/pull/6394#discussion_r34384968
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/DAGScheduler.scala 
---
    @@ -872,6 +872,25 @@ class DAGScheduler(
         // will be posted, which should always come after a corresponding 
SparkListenerStageSubmitted
         // event.
         stage.latestInfo = StageInfo.fromStage(stage, 
Some(partitionsToCompute.size))
    +    val taskIdToLocations = try {
    +      stage match {
    +        case s: ShuffleMapStage =>
    +          partitionsToCompute.map { id => (id, getPreferredLocs(stage.rdd, 
id))}.toMap
    +        case s: ResultStage =>
    +          val job = s.resultOfJob.get
    +          partitionsToCompute.map { id =>
    +            val p = job.partitions(id)
    +            (id, getPreferredLocs(stage.rdd, p))
    +          }.toMap
    +      }
    +    } catch {
    +      case NonFatal(e) =>
    +        abortStage(stage, s"Task creation failed: 
$e\n${e.getStackTraceString}")
    +        runningStages -= stage
    +        return
    +    }
    +    stage.latestInfo.taskLocalityPreferences = 
Some(taskIdToLocations.values.toSeq)
    --- End diff --
    
    (you could wrap the fromStage() call in the try/catch, so you can still 
properly abort the stage if an exception gets thrown)


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

Reply via email to