spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andrewor14 <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-6079] Use index to speed up StatusTrack...
Date Tue, 24 Mar 2015 21:48:59 GMT
Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4830#discussion_r27076974
  
    --- Diff: core/src/main/scala/org/apache/spark/ui/jobs/JobProgressListener.scala ---
    @@ -140,7 +143,16 @@ class JobProgressListener(conf: SparkConf) extends SparkListener
with Logging {
         if (jobs.size > retainedJobs) {
           val toRemove = math.max(retainedJobs / 10, 1)
           jobs.take(toRemove).foreach { job =>
    -        jobIdToData.remove(job.jobId)
    +        for (
    +          removedJob <- jobIdToData.remove(job.jobId);
    +          jobGroupId = removedJob.jobGroup.orNull;
    +          jobsInGroup <- jobGroupToJobIds.get(jobGroupId)
    --- End diff --
    
    this mix and match of `<-` and `=` took me a while to figure out what's going on. Can
we rewrite this:
    ```
    jobs.take(toRemove).foreach { job =>
      jobIdToData.remove(job.jobId).foreach { removedJob =>
        val jobGroupId = removedJob.jobGroup.orNull
        val jobsInGroup = jobGroupToJobIds.get(jobGroupId)
        jobsInGroup.remove(job.jobId)
        ...
      }
    }
    ```


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


Mime
View raw message