remove yarn.url configure item

This commit is contained in:
judy0131 2020-01-19 10:52:05 +08:00
parent c0991b3cda
commit b245a7f6b4
3 changed files with 17 additions and 4 deletions

View File

@ -70,8 +70,21 @@ object ConfigureUtil {
piflowBundlePath
}
def getYarnResourceManagerWebAppAddress() : String = {
var yarnResourceManagerWebAppAddress = PropertyUtil.getPropertyValue("yarn.url")
if(yarnResourceManagerWebAppAddress == null){
var port = "8088"
val yarnHostName = PropertyUtil.getPropertyValue("yarn.resourcemanager.hostname")
if(PropertyUtil.getPropertyValue("yarn.resourcemanager.webapp.address.port") != null){
port = PropertyUtil.getPropertyValue("yarn.resourcemanager.webapp.address.port")
}
yarnResourceManagerWebAppAddress = "http://" + yarnHostName + ":" + port + "/ws/v1/cluster/apps/"
}
yarnResourceManagerWebAppAddress
}
def main(args: Array[String]): Unit = {
val piflowBundlePath = getPiFlowBundlePath()
val temp = getYarnResourceManagerWebAppAddress()
}
}

View File

@ -71,7 +71,7 @@ object FlowLauncher {
println("Stop Flow !!!!!!!!!!!!!!!!!!!!!!!!!!")
//yarn application kill appId
val url = PropertyUtil.getPropertyValue("yarn.url") + appID + "/state"
val url = ConfigureUtil.getYarnResourceManagerWebAppAddress() + appID + "/state"
val client = HttpClients.createDefault()
val put:HttpPut = new HttpPut(url)
val body ="{\"state\":\"KILLED\"}"

View File

@ -202,7 +202,7 @@ object API {
def stopFlowOnYarn(appID : String) : String = {
//yarn application kill appId
val url = PropertyUtil.getPropertyValue("yarn.url") + appID + "/state"
val url = ConfigureUtil.getYarnResourceManagerWebAppAddress() + appID + "/state"
val client = HttpClients.createDefault()
val put:HttpPut = new HttpPut(url)
val body ="{\"state\":\"KILLED\"}"
@ -224,7 +224,7 @@ object API {
}
def getFlowLog(appID : String) : String = {
val url = PropertyUtil.getPropertyValue("yarn.url") + appID
val url = ConfigureUtil.getYarnResourceManagerWebAppAddress() + appID
val client = HttpClients.createDefault()
val get:HttpGet = new HttpGet(url)