1.1 如何启动AM并申请资源
1.1.1 如何启动AM
val yarnClient = YarnClient.createYarnClient setupCredentials() yarnClient.init(yarnConf) yarnClient.start()// Get a new application from our RMval newApp = yarnClient.createApplication() val newAppResponse = newApp.getNewApplicationResponse() appId = newAppResponse.getApplicationId() // Set up the appropriate contexts to launch our AMval containerContext = createContainerLaunchContext(newAppResponse) val appContext = createApplicationSubmissionContext(newApp, containerContext) // Finally, submit and monitor the applicationlogInfo(s"Submitting application $appId to ResourceManager") yarnClient.submitApplication(appContext)
1.1.2 FairScheduler如何处理AM的ResourceRequest
1、FairScheduler接收到SchedulerEventType.APP