我正在运行一个带有8个vCores和8Gb总内存的本地Yarn Cluster.
工作流程如下:
YarnClient提交一个应用程序请求,用于在容器中启动AppMaster.
AppMaster启动,创建amRMClient和nmClient,将自己注册到RM,然后通过amRMClient.addContainerRequest为工作线程创建4个容器请求
即使有足够的资源,也没有分配容器(永远不会调用回调函数onContainersAllocated).我尝试检查nodemanager和resourcemanager的日志,但我没有看到任何与容器请求相关的行.我密切关注apache文档,无法理解我做错了什么.
这里是AppMaster代码的参考:
@Override
public void run() {
Map<String, String> envs = System.getenv();
String containerIdString = envs.get(ApplicationConstants.Environment.CONTAINER_ID.toString());
if (containerIdString == null) {
// container id should always be set in the env by the framework
throw new IllegalArgumentException("ContainerId not set in the environment");
}
ContainerId containerId = ConverterUtils.toContainerId(containerIdString);
ApplicationAttemptId appAttemptID = containerId.getApplicationAttemptId();
LOG.info("Starting AppMaster Client...");
YarnAMRMCallbackHandler amHandler = new YarnAMRMCallbackHandler(allocatedYarnContainers);
// TODO: get heart-beet interval from config instead of 100 default value
amClient = AMRMClientAsync.createAMRMClientAsync(1000, this); …Run Code Online (Sandbox Code Playgroud)