Skip to content
Snippets Groups Projects
Commit 89da9d94 authored by Patrick Wendell's avatar Patrick Wendell
Browse files

Add JSON path to master index page

parent f3cf0949
No related branches found
No related tags found
No related merge requests found
......@@ -25,15 +25,22 @@ import javax.servlet.http.HttpServletRequest
import scala.xml.Node
import spark.deploy.{RequestMasterState, DeployWebUI, MasterState}
import spark.deploy.{JsonProtocol, RequestMasterState, DeployWebUI, MasterState}
import spark.Utils
import spark.ui.UIUtils
import spark.deploy.master.{ApplicationInfo, WorkerInfo}
import net.liftweb.json.JsonAST.JValue
private[spark] class IndexPage(parent: MasterWebUI) {
val master = parent.master
implicit val timeout = parent.timeout
def renderJson(request: HttpServletRequest): JValue = {
val stateFuture = (master ? RequestMasterState)(timeout).mapTo[MasterState]
val state = Await.result(stateFuture, 30 seconds)
JsonProtocol.writeMasterState(state)
}
/** Index view listing applications and executors */
def render(request: HttpServletRequest): Seq[Node] = {
val stateFuture = (master ? RequestMasterState)(timeout).mapTo[MasterState]
......
......@@ -61,6 +61,7 @@ class MasterWebUI(val master: ActorRef, requestedPort: Int) extends Logging {
("/static", createStaticHandler(MasterWebUI.STATIC_RESOURCE_DIR)),
("/app/json", (request: HttpServletRequest) => applicationPage.renderJson(request)),
("/app", (request: HttpServletRequest) => applicationPage.render(request)),
("/json", (request: HttpServletRequest) => indexPage.renderJson(request)),
("*", (request: HttpServletRequest) => indexPage.render(request))
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment