简体   繁体   中英

How ApplicationMaster in Client mode in Spark-yarn works?

I'm quite new at spark. Currently I'm looking Spark code to better understand how it works.

As far as I understand, In Spark Client mode, org.apache.spark.deploy.SparkSubmit class launches user's class wrapped by org.apache.spark.deploy.JavaMainApplication in this code(If my class doesn't extend SparkApplication)

val app: SparkApplication = if (classOf[SparkApplication].isAssignableFrom(mainClass)) {
  mainClass.getConstructor().newInstance().asInstanceOf[SparkApplication]
} else {
  new JavaMainApplication(mainClass) //Here my class will be ran by this
}
...
app.start(childArgs.toArray, sparkConf)

But user application doesn't have any launching ApplicationMaster logic. I don't understand how ApplicationMaster is up in client mode if my class doesn't implement org.apache.spark.deploy.SparkApplication .

One thing I found out is there is the org.apache.spark.deploy.yarn.ExecutorLauncher in spark yarn package, but I have no idea how it is ran if user doesn't extend SparkApplication.

I managed to figure out how it works. It is initialized in SparkContext when TaskScheduler is initialized

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM