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

    https://github.com/apache/spark/pull/2342#discussion_r28992311
  
    --- Diff: core/src/main/scala/org/apache/spark/ui/jobs/AllJobsPage.scala ---
    @@ -17,17 +17,170 @@
     
     package org.apache.spark.ui.jobs
     
    -import scala.xml.{Node, NodeSeq}
    +import scala.collection.mutable.ListBuffer
    +import scala.xml.{Node, NodeSeq, Unparsed}
     
    +import java.util.Date
     import javax.servlet.http.HttpServletRequest
     
    -import org.apache.spark.ui.{WebUIPage, UIUtils}
    -import org.apache.spark.ui.jobs.UIData.JobUIData
    +import org.apache.spark.ui.{UIUtils, WebUIPage}
    +import org.apache.spark.ui.jobs.UIData.{ExecutorUIData, JobUIData}
    +import org.apache.spark.JobExecutionStatus
     
     /** Page showing list of all ongoing and recently finished jobs */
     private[ui] class AllJobsPage(parent: JobsTab) extends WebUIPage("") {
    -  private val startTime: Option[Long] = parent.sc.map(_.startTime)
    -  private val listener = parent.listener
    +  private val JOBS_LEGEND =
    +    <div class="legend-area"><svg width="200px" height="85px">
    +      <rect x="5px" y="5px" width="20px" height="15px"
    +            rx="2px" ry="2px" stroke="#97B0F8" fill="#D5DDF6"></rect>
    +      <text x="35px" y="17px">Succeeded Job</text>
    +      <rect x="5px" y="35px" width="20px" height="15px"
    +            rx="2px" ry="2px" stroke="#97B0F8" fill="#FF5475"></rect>
    +      <text x="35px" y="47px">Failed Job</text>
    +      <rect x="5px" y="65px" width="20px" height="15px"
    +            rx="2px" ry="2px" stroke="#97B0F8" fill="#FDFFCA"></rect>
    +      <text x="35px" y="77px">Running Job</text>
    +    </svg></div>.toString.filter(_ != '\n')
    +
    +  private val EXECUTORS_LEGEND =
    +    <div class="legend-area"><svg width="200px" height="55px">
    +      <rect x="5px" y="5px" width="20px" height="15px"
    +            rx="2px" ry="2px" stroke="#97B0F8" fill="#D5DDF6"></rect>
    +      <text x="35px" y="17px">Executor Added</text>
    +      <rect x="5px" y="35px" width="20px" height="15px"
    +            rx="2px" ry="2px" stroke="#97B0F8" fill="#EBCA59"></rect>
    +      <text x="35px" y="47px">Executor Removed</text>
    +    </svg></div>.toString.filter(_ != '\n')
    +
    +  private def getlastStageDescription(job: JobUIData) = {
    +    val lastStageInfo = Option(job.stageIds)
    +      .filter(_.nonEmpty)
    +      .flatMap { ids => parent.listener.stageIdToInfo.get(ids.max)}
    +    val lastStageData = lastStageInfo.flatMap { s =>
    +      parent.listener.stageIdToData.get((s.stageId, s.attemptId))
    +    }
    +    lastStageData.flatMap(_.description).getOrElse("")
    +  }
    +
    +  private def makeJobEvent(jobUIDatas: Seq[JobUIData]): Seq[String] = {
    +    jobUIDatas.filter { jobUIData =>
    +      jobUIData.status != JobExecutionStatus.UNKNOWN && 
jobUIData.submissionTime.isDefined
    +    }.map { jobUIData =>
    +      val jobId = jobUIData.jobId
    +      val status = jobUIData.status
    +      val jobDescription = getlastStageDescription(jobUIData)
    +      val submissionTime = jobUIData.submissionTime.get
    +      val completionTimeOpt = jobUIData.completionTime
    +      val completionTime = 
completionTimeOpt.getOrElse(System.currentTimeMillis())
    +      val classNameByStatus = status match {
    +        case JobExecutionStatus.SUCCEEDED => "succeeded"
    +        case JobExecutionStatus.FAILED => "failed"
    +        case JobExecutionStatus.RUNNING => "running"
    +      }
    +
    +      val jobEventJsonAsStr =
    +        s"""
    +           |{
    +           |  'className': 'job application-timeline-object 
${classNameByStatus}',
    +           |  'group': 'jobs',
    +           |  'start': new Date(${submissionTime}),
    +           |  'end': new Date(${completionTime}),
    +           |  'content': '<div class="application-timeline-content">' +
    +           |    '${jobDescription} (Job ${jobId})</div>',
    --- End diff --
    
    Can this link to the job entry in the table? Actually, if possible it would 
be nice if on hover, we highlighted the row in the table. This should be pretty 
easy to do with javascript.


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