All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.spark.sql.execution.ui.ExecutionPage.scala Maven / Gradle / Ivy

There is a newer version: 1.6.2-6
Show newest version
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.spark.sql.execution.ui

import javax.servlet.http.HttpServletRequest

import scala.xml.{Node, Unparsed}

import org.apache.commons.lang3.StringEscapeUtils

import org.apache.spark.Logging
import org.apache.spark.ui.{UIUtils, WebUIPage}

private[sql] class ExecutionPage(parent: SQLTab) extends WebUIPage("execution") with Logging {

  private val listener = parent.listener

  override def render(request: HttpServletRequest): Seq[Node] = listener.synchronized {
    val parameterExecutionId = request.getParameter("id")
    require(parameterExecutionId != null && parameterExecutionId.nonEmpty,
      "Missing execution id parameter")

    val executionId = parameterExecutionId.toLong
    val content = listener.getExecution(executionId).map { executionUIData =>
      val currentTime = System.currentTimeMillis()
      val duration =
        executionUIData.completionTime.getOrElse(currentTime) - executionUIData.submissionTime

      val summary =
        
  • Submitted Time: {UIUtils.formatDate(executionUIData.submissionTime)}
  • Duration: {UIUtils.formatDuration(duration)}
  • {if (executionUIData.runningJobs.nonEmpty) {
  • Running Jobs: {executionUIData.runningJobs.sorted.map { jobId => {jobId.toString}  }}
  • }} {if (executionUIData.succeededJobs.nonEmpty) {
  • Succeeded Jobs: {executionUIData.succeededJobs.sorted.map { jobId => {jobId.toString}  }}
  • }} {if (executionUIData.failedJobs.nonEmpty) {
  • Failed Jobs: {executionUIData.failedJobs.sorted.map { jobId => {jobId.toString}  }}
  • }}
val metrics = listener.getExecutionMetrics(executionId) summary ++ planVisualization(metrics, executionUIData.physicalPlanGraph) ++ physicalPlanDescription(executionUIData.physicalPlanDescription) }.getOrElse {
No information to display for Plan {executionId}
} UIUtils.headerSparkPage(s"Details for Query $executionId", content, parent, Some(5000)) } private def planVisualizationResources: Seq[Node] = { // scalastyle:off // scalastyle:on } private def planVisualization(metrics: Map[Long, String], graph: SparkPlanGraph): Seq[Node] = { val metadata = graph.nodes.flatMap { node => val nodeId = s"plan-meta-data-${node.id}"
{node.desc}
}
{planVisualizationResources}
} private def jobURL(jobId: Long): String = "%s/jobs/job?id=%s".format(UIUtils.prependBaseUri(parent.basePath), jobId) private def physicalPlanDescription(physicalPlanDescription: String): Seq[Node] = {
} }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy