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

    https://github.com/apache/spark/pull/1854#discussion_r15989111
  
    --- Diff: 
core/src/main/scala/org/apache/spark/ui/jobs/JobProgressListener.scala ---
    @@ -84,7 +84,11 @@ class JobProgressListener(conf: SparkConf) extends 
SparkListener with Logging {
       private def trimIfNecessary(stages: ListBuffer[StageInfo]) = 
synchronized {
         if (stages.size > retainedStages) {
           val toRemove = math.max(retainedStages / 10, 1)
    -      stages.take(toRemove).foreach { s => stageIdToData.remove(s.stageId) 
}
    +      stages.take(toRemove).foreach { s =>
    +        if (!activeStages.contains(s.stageId)) {
    +          stageIdToData.remove(s.stageId) 
    +        }
    +      }
           stages.trimStart(toRemove)
    --- End diff --
    
    Putting the two comments together, I think that to avoid getting different 
results when querying `activeStages`, this has to proceed by separating the 
stages to be removed from the rest, invoking the `foreach` on the former, and 
then returning the rest.


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