当前位置:网站首页>Flink Yarn Per Job - Submit application
Flink Yarn Per Job - Submit application
2022-08-03 09:03:00 【hyunbar】
YarnClusterDescriptor
private ApplicationReport startAppMaster(
Configuration configuration,
String applicationName,
String yarnClusterEntrypoint,
JobGraph jobGraph,
YarnClient yarnClient,
YarnClientApplication yarnApplication,
ClusterSpecification clusterSpecification) throws Exception {
... ...
yarnClient.submitApplication(appContext);
... ...
}
YarnClientImpl extends YarnClient
public ApplicationId submitApplication(ApplicationSubmissionContext appContext) throws YarnException, IOException {
ApplicationId applicationId = appContext.getApplicationId();
if (applicationId == null) {
throw new ApplicationIdNotProvidedException("ApplicationId is not provided in ApplicationSubmissionContext");
} else {
SubmitApplicationRequest request = (SubmitApplicationRequest)Records.newRecord(SubmitApplicationRequest.class);
request.setApplicationSubmissionContext(appContext);
// 重要
this.rmClient.submitApplication(request);
... ...
}
}
ApplicationClientProtocolPBClientImpl implements ApplicationClientProtocol
public SubmitApplicationResponse submitApplication(SubmitApplicationRequest request) throws YarnException, IOException {
SubmitApplicationRequestProto requestProto = ((SubmitApplicationRequestPBImpl)request).getProto();
try {
return new SubmitApplicationResponsePBImpl(this.proxy.submitApplication((RpcController)null, requestProto));
} catch (ServiceException var4) {
RPCUtil.unwrapAndThrowException(var4);
return null;
}
}
ClientRMService
@Override
public SubmitApplicationResponse submitApplication(
SubmitApplicationRequest request) throws YarnException {
ApplicationSubmissionContext submissionContext = request
.getApplicationSubmissionContext();
ApplicationId applicationId = submissionContext.getApplicationId();
// ApplicationSubmissionContext needs to be validated for safety - only
// those fields that are independent of the RM's configuration will be
// checked here, those that are dependent on RM configuration are validated
// in RMAppManager.
String user = null;
try {
// Safety
// 安全校验
user = UserGroupInformation.getCurrentUser().getShortUserName();
} catch (IOException ie) {
LOG.warn("Unable to get the current user.", ie);
RMAuditLogger.logFailure(user, AuditConstants.SUBMIT_APP_REQUEST,
ie.getMessage(), "ClientRMService",
"Exception in submitting application", applicationId);
throw RPCUtil.getRemoteException(ie);
}
// Check whether app has already been put into rmContext,
// If it is, simply return the response
if (rmContext.getRMApps().get(applicationId) != null) {
LOG.info("This is an earlier submitted application: " + applicationId);
return SubmitApplicationResponse.newInstance();
}
if (submissionContext.getQueue() == null) {
// DEFAULT_QUEUE_NAME = "default"
submissionContext.setQueue(YarnConfiguration.DEFAULT_QUEUE_NAME);
}
if (submissionContext.getApplicationName() == null) {
submissionContext.setApplicationName(
// DEFAULT_APPLICATION_NAME = "N/A"
YarnConfiguration.DEFAULT_APPLICATION_NAME);
}
if (submissionContext.getApplicationType() == null) {
submissionContext
// DEFAULT_APPLICATION_TYPE = "YARN"
.setApplicationType(YarnConfiguration.DEFAULT_APPLICATION_TYPE);
} else {
if (submissionContext.getApplicationType().length() > YarnConfiguration.APPLICATION_TYPE_LENGTH) {
submissionContext.setApplicationType(submissionContext
.getApplicationType().substring(0,
YarnConfiguration.APPLICATION_TYPE_LENGTH));
}
}
try {
// call RMAppManager to submit application directly
// 直接调用 RMAppManager 提交应用
rmAppManager.submitApplication(submissionContext,
System.currentTimeMillis(), user);
LOG.info("Application with id " + applicationId.getId() +
" submitted by user " + user);
RMAuditLogger.logSuccess(user, AuditConstants.SUBMIT_APP_REQUEST,
"ClientRMService", applicationId);
} catch (YarnException e) {
LOG.info("Exception in submitting application with id " +
applicationId.getId(), e);
RMAuditLogger.logFailure(user, AuditConstants.SUBMIT_APP_REQUEST,
e.getMessage(), "ClientRMService",
"Exception in submitting application", applicationId);
throw e;
}
SubmitApplicationResponse response = recordFactory
.newRecordInstance(SubmitApplicationResponse.class);
return response;
}
// call RMAppManager to submit application directly
// 直接调用 RMAppManager 提交应用
rmAppManager.submitApplication(submissionContext,
System.currentTimeMillis(), user);
边栏推荐
- Network LSTM both short-term and long-term memory
- HCIP练习03(重发布)
- Machine learning (formula derivation and code implementation)--sklearn machine learning library
- 命令行加载特效 【cli-spinner.js】 实用教程
- The window of the chosen data flow
- 【字节面试】word2vector输出多少个类别
- HCIP实验(06)
- 固件工程师到底是干什么?
- Laya中关于摄像机跟随人物移动或者点击人物碰撞器触发事件的Demo
- 【LeetCode】101.对称二叉树
猜你喜欢
随机推荐
数仓4.0(一)
SQL Daily Practice (Nioke New Question Bank) - Day 5: Advanced Query
【字节面试】word2vector输出多少个类别
Industry SaaS Microservice Stability Guarantee Actual Combat
面渣逆袭:MySQL六十六问,两万字+五十图详解
合并两个有序链表
MySQL-存储过程-函数-
The window of the chosen data flow
QImage的指针问题
【论文笔记】基于动作空间划分的MAXQ自动分层方法
dflow入门2——Slices
pytorch one-hot 小技巧
NFT到底有哪些实际用途?
swiper分类菜单双层效果demo(整理)
进程信息
二进制日志过期时间设置expire_logs_days
兔起鹘落全端涵盖,Go lang1.18入门精炼教程,由白丁入鸿儒,全平台(Sublime 4)Go lang开发环境搭建EP00
国内IT市场还有发展吗?有哪些创新好用的IT运维工具可以推荐?
The display of the article list and the basics of creating articles and article details
scala减少,reduceLeft reduceRight,折叠,foldLeft foldRight