forked from apache/spark
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-2411] Add a history-not-found page to standalone Master
**Problem.** Right now, if you click on an application after it has finished, it simply refreshes the page if there are no event logs for the application. This is not super intuitive especially because event logging is not enabled by default. We should direct the user to enable this if they attempt to view a SparkUI after the fact without event logs. **Fix.** The new page conveys different messages in each of the following scenarios: (1) Application did not enable event logging, (2) Event logs are not found in the specified directory, and (3) Exception is thrown while replaying the logs Here are screenshots of what the page looks like in each of the above scenarios: (1) <img src="https://issues.apache.org/jira/secure/attachment/12656204/Event%20logging%20not%20enabled.png" width="75%"> (2) <img src="https://issues.apache.org/jira/secure/attachment/12656203/Application%20history%20not%20found.png"> (3) <img src="https://issues.apache.org/jira/secure/attachment/12656202/Application%20history%20load%20error.png" width="95%"> Author: Andrew Or <[email protected]> Closes apache#1336 from andrewor14/master-link and squashes the following commits: 2f06206 [Andrew Or] Merge branch 'master' of github.com:apache/spark into master-link 97cddc0 [Andrew Or] Add different severity levels 832b687 [Andrew Or] Mention spark.eventLog.dir in error message 51980c3 [Andrew Or] Merge branch 'master' of github.com:apache/spark into master-link ded208c [Andrew Or] Merge branch 'master' of github.com:apache/spark into master-link 89d6405 [Andrew Or] Reword message e7df7ed [Andrew Or] Add a history not found page to standalone Master
- Loading branch information
1 parent
72e9021
commit 6afca2d
Showing
6 changed files
with
132 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
core/src/main/scala/org/apache/spark/deploy/master/ui/HistoryNotFoundPage.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* 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.master.ui | ||
|
||
import java.net.URLDecoder | ||
import javax.servlet.http.HttpServletRequest | ||
|
||
import scala.xml.Node | ||
|
||
import org.apache.spark.ui.{UIUtils, WebUIPage} | ||
|
||
private[spark] class HistoryNotFoundPage(parent: MasterWebUI) | ||
extends WebUIPage("history/not-found") { | ||
|
||
/** | ||
* Render a page that conveys failure in loading application history. | ||
* | ||
* This accepts 3 HTTP parameters: | ||
* msg = message to display to the user | ||
* title = title of the page | ||
* exception = detailed description of the exception in loading application history (if any) | ||
* | ||
* Parameters "msg" and "exception" are assumed to be UTF-8 encoded. | ||
*/ | ||
def render(request: HttpServletRequest): Seq[Node] = { | ||
val titleParam = request.getParameter("title") | ||
val msgParam = request.getParameter("msg") | ||
val exceptionParam = request.getParameter("exception") | ||
|
||
// If no parameters are specified, assume the user did not enable event logging | ||
val defaultTitle = "Event logging is not enabled" | ||
val defaultContent = | ||
<div class="row-fluid"> | ||
<div class="span12" style="font-size:14px"> | ||
No event logs were found for this application! To | ||
<a href="http://spark.apache.org/docs/latest/monitoring.html">enable event logging</a>, | ||
set <span style="font-style:italic">spark.eventLog.enabled</span> to true and | ||
<span style="font-style:italic">spark.eventLog.dir</span> to the directory to which your | ||
event logs are written. | ||
</div> | ||
</div> | ||
|
||
val title = Option(titleParam).getOrElse(defaultTitle) | ||
val content = Option(msgParam) | ||
.map { msg => URLDecoder.decode(msg, "UTF-8") } | ||
.map { msg => | ||
<div class="row-fluid"> | ||
<div class="span12" style="font-size:14px">{msg}</div> | ||
</div> ++ | ||
Option(exceptionParam) | ||
.map { e => URLDecoder.decode(e, "UTF-8") } | ||
.map { e => <pre>{e}</pre> } | ||
.getOrElse(Seq.empty) | ||
}.getOrElse(defaultContent) | ||
|
||
UIUtils.basicSparkPage(content, title) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters