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-1276] Add a HistoryServer to render per...
Date Wed, 09 Apr 2014 08:18:05 GMT
Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/204#discussion_r11426446
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/history/IndexPage.scala ---
    @@ -0,0 +1,76 @@
    +/*
    + * 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.deploy.history
    +
    +import javax.servlet.http.HttpServletRequest
    +
    +import scala.xml.Node
    +
    +import org.apache.spark.ui.{UIUtils, WebUI}
    +
    +private[spark] class IndexPage(parent: HistoryServer) {
    +
    +  def render(request: HttpServletRequest): Seq[Node] = {
    +    parent.checkForLogs()
    +
    +    // Populate app table, with most recently modified app first
    +    val appRows = parent.appIdToInfo.values.toSeq.sortBy { app => -app.lastUpdated
}
    +    val appTable = UIUtils.listingTable(appHeader, appRow, appRows)
    +    val content =
    +      <div class="row-fluid">
    +        <div class="span12">
    +          <ul class="unstyled">
    +            <li><strong>Event Log Location: </strong> {parent.baseLogDir}</li>
    +            <h4>
    +              Showing {parent.appIdToInfo.size}/{parent.getTotalApplications} Finished
Applications
    +            </h4>
    +            {appTable}
    +          </ul>
    +        </div>
    +      </div>
    +
    +    UIUtils.basicSparkPage(content, "History Server")
    +  }
    +
    +  private val appHeader = Seq(
    +    "App Name",
    +    "Started",
    +    "Finished",
    +    "Duration",
    +    "Log Directory",
    +    "Last Updated")
    +
    +  private def appRow(info: ApplicationHistoryInfo): Seq[Node] = {
    +    val appName = if (info.started) info.name else parent.getAppId(info.logPath)
    +    val uiAddress = parent.getAddress + info.ui.basePath
    +    val startTime = if (info.started) WebUI.formatDate(info.startTime) else "Not started"
    +    val endTime = if (info.finished) WebUI.formatDate(info.endTime) else "Not finished"
    +    val difference = if (info.started && info.finished) info.endTime - info.startTime
else -1L
    +    val duration = if (difference > 0) WebUI.formatDuration(difference) else "---"
    +    val logDirectory = parent.getAppId(info.logPath)
    --- End diff --
    
    This is added in the latest commit


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

Mime
View raw message