Add JSON path to master index page
This commit is contained in:
parent
f3cf09491a
commit
89da9d94b3
|
@ -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))
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue