set appname

This commit is contained in:
judy0131 2018-10-08 13:46:12 +08:00
parent f577b6ad79
commit f2510a4285
4 changed files with 10 additions and 5 deletions

View File

@ -5,7 +5,7 @@ import java.util.concurrent.CountDownLatch
import cn.piflow.Runner import cn.piflow.Runner
import cn.piflow.conf.bean.{FlowBean, PropertyDescriptor} import cn.piflow.conf.bean.{FlowBean, PropertyDescriptor}
import org.apache.spark.sql.SparkSession import org.apache.spark.sql.SparkSession
import cn.piflow.conf.util.{ClassUtil, OptionUtil} import cn.piflow.conf.util.{ClassUtil, MapUtil, OptionUtil}
import cn.piflow.Process import cn.piflow.Process
import cn.piflow.api.util.PropertyUtil import cn.piflow.api.util.PropertyUtil
import org.apache.http.client.methods.{CloseableHttpResponse, HttpGet, HttpPost} import org.apache.http.client.methods.{CloseableHttpResponse, HttpGet, HttpPost}
@ -57,10 +57,16 @@ object API {
}*/ }*/
def startFlow(flowJson : String):(String,SparkAppHandle) = { def startFlow(flowJson : String):(String,SparkAppHandle) = {
var appId:String = null var appId:String = null
val map = OptionUtil.getAny(JSON.parseFull(flowJson)).asInstanceOf[Map[String, Any]]
val flowMap = MapUtil.get(map, "flow").asInstanceOf[Map[String, Any]]
val appName = MapUtil.get(flowMap,"name").asInstanceOf[String]
val countDownLatch = new CountDownLatch(1) val countDownLatch = new CountDownLatch(1)
val launcher = new SparkLauncher val launcher = new SparkLauncher
val handle =launcher//.setMaster(PropertyUtil.getPropertyValue("spark.master")) val handle =launcher
.setAppName(appName)
.setMaster(PropertyUtil.getPropertyValue("spark.master")) .setMaster(PropertyUtil.getPropertyValue("spark.master"))
.setDeployMode(PropertyUtil.getPropertyValue("spark.deploy.mode")) .setDeployMode(PropertyUtil.getPropertyValue("spark.deploy.mode"))
.setAppResource(PropertyUtil.getPropertyValue("piflow.bundle")) .setAppResource(PropertyUtil.getPropertyValue("piflow.bundle"))

View File

@ -13,7 +13,7 @@ object HTTPClientStartFlow {
val json =""" val json ="""
|{ |{
| "flow":{ | "flow":{
| "name":"test", | "name":"xml,csv-merge-fork-hive,json,csv",
| "uuid":"1234", | "uuid":"1234",
| "checkpoint":"Merge", | "checkpoint":"Merge",
| "stops":[ | "stops":[

View File

@ -12,7 +12,7 @@ object HTTPClientStartFlow1 {
""" """
|{ |{
| "flow":{ | "flow":{
| "name":"test", | "name":"xml2csv",
| "uuid":"1234", | "uuid":"1234",
| "checkpoint":"Merge", | "checkpoint":"Merge",
| "stops":[ | "stops":[

View File

@ -13,7 +13,6 @@ object StartFlowMain {
def main(args: Array[String]): Unit = { def main(args: Array[String]): Unit = {
val flowJson = args(0) val flowJson = args(0)
println(flowJson) println(flowJson)
val t = JSON.parseFull(flowJson)
val map = OptionUtil.getAny(JSON.parseFull(flowJson)).asInstanceOf[Map[String, Any]] val map = OptionUtil.getAny(JSON.parseFull(flowJson)).asInstanceOf[Map[String, Any]]
println(map) println(map)