You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/05/06 15:34:51 UTC

[GitHub] [spark] gengliangwang commented on a change in pull request #32381: [SPARK-35229][WEBUI] Limit the maximum number of items on the timeline view.

gengliangwang commented on a change in pull request #32381:
URL: https://github.com/apache/spark/pull/32381#discussion_r627530249



##########
File path: core/src/main/scala/org/apache/spark/ui/jobs/AllJobsPage.scala
##########
@@ -64,9 +68,12 @@ private[ui] class AllJobsPage(parent: JobsTab, store: AppStatusStore) extends We
     </svg></div>.toString.filter(_ != '\n')
 
   private def makeJobEvent(jobs: Seq[v1.JobData]): Seq[String] = {
+    val now = System.currentTimeMillis()
     jobs.filter { job =>
       job.status != JobExecutionStatus.UNKNOWN && job.submissionTime.isDefined
-    }.map { job =>
+    }.sortBy { j =>
+      (-j.completionTime.map(_.getTime).getOrElse(now), -j.submissionTime.get.getTime)
+    }.take(MAX_TIMELINE_JOBS).map { job =>

Review comment:
       nit: how about 
   sortBy(completionTime, submissionTime).takeRight
   
   the negative value is not straightforward.




-- 
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:
users@infra.apache.org



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