YARN源码剖析:NM之ContainerExecutor

ContainerExecutor的继承关系

在这里插入图片描述

ContainerExecutor的实例化

ContainerExecutor的实例化是在NM初始化方法serviceInit()中完成的,通过配置参数yarn.nodemanager.container-executor.class 来配置使用哪种ContainerExecutor,默认使用DefaultContainerExecutor。如下:

ContainerExecutor exec = ReflectionUtils.newInstance(
    conf.getClass(YarnConfiguration.NM_CONTAINER_EXECUTOR,
      DefaultContainerExecutor.class, ContainerExecutor.class), conf);
try {
  exec.init();
} catch (IOException e) {
  throw new YarnRuntimeException("Failed to initialize container executor", e);
}    

ContainerExecutor的使用

在NM的serviceInit()方法中看到有两处在使用ContainerExecutor,如下:

DeletionService del = createDeletionService(exec);
addService(del);
    
containerManager =
        createContainerManager(context, exec, del, nodeStatusUpdater,
        this.aclsManager, dirsHandler);
addService(containerManager);

TODO:具体是如何使用的?

三种ContainerExecutor分析

(1)DefaultContainerExecutor
先看构造方法(上面的反射用)

public DefaultContainerExecutor() {
    try {
      //构造了一个本地文件系统上下文对象,即FS的URL为file:///,其他配置就是new Configuration()
      this.lfs = FileContext.getLocalFSFileContext();
    } catch (UnsupportedFileSystemException e) {
      throw new RuntimeException(e);
    }
  }

再看init方法

@Override
  public void init() throws IOException {
    // nothing to do or verify here
  }

TODO:具体实现?

(2)DockerContainerExecutor
(3)LinuxContainerExecutor

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值