apache-spark Spark Launcher SparkLauncher


Below code is basic example of spark launcher.This can be used if spark job has to be launched through some application.

val sparkLauncher = new SparkLauncher
//Set Spark properties.only Basic ones are shown here.It will be overridden if properties are set in Main class.
  .setMaster("MasterType like yarn or local[*]")
  .setDeployMode("set deploy mode like cluster")

// Lauch spark application
val sparkLauncher1 = sparkLauncher.startApplication()

//get jobId
val jobAppId = sparkLauncher1.getAppId

//Get status of job launched.THis loop will continuely show statuses like RUNNING,SUBMITED etc.
while (true) {