YarnNamespaceUtils.setValueIfAttributeDefined(defBuilder, containerRunnerElement, "context-file", false, "container-context.xml");
YarnNamespaceUtils.setValueIfAttributeDefined(defBuilder, containerRunnerElement, "bean-name", false, YarnSystemConstants.DEFAULT_ID_CONTAINER);
YarnNamespaceUtils.setReferenceIfAttributeDefined(defBuilder, containerRunnerElement, "arguments");
YarnNamespaceUtils.setValueIfAttributeDefined(defBuilder, containerRunnerElement, "stdout", false, "<LOG_DIR>/Container.stdout");
YarnNamespaceUtils.setValueIfAttributeDefined(defBuilder, containerRunnerElement, "stderr", false, "<LOG_DIR>/Container.stderr");
AbstractBeanDefinition beanDef = defBuilder.getBeanDefinition();
String beanName = BeanDefinitionReaderUtils.generateBeanName(beanDef, parserContext.getRegistry());
parserContext.registerBeanComponent(new BeanComponentDefinition(beanDef, beanName));
builder.addPropertyReference("commands", beanName);
}
// allocator - for now, defaulting to DefaultContainerAllocator
BeanDefinitionBuilder defBuilder = BeanDefinitionBuilder.genericBeanDefinition(DefaultContainerAllocator.class);
defBuilder.addPropertyReference("configuration", YarnSystemConstants.DEFAULT_ID_CONFIGURATION);
Element allocElement = DomUtils.getChildElementByTagName(element, "container-allocator");
YarnNamespaceUtils.setReferenceIfAttributeDefined(defBuilder, element, "environment", YarnSystemConstants.DEFAULT_ID_ENVIRONMENT);
if(allocElement != null) {
YarnNamespaceUtils.setValueIfAttributeDefined(defBuilder, allocElement, "hostname");
YarnNamespaceUtils.setValueIfAttributeDefined(defBuilder, allocElement, "virtualcores");
YarnNamespaceUtils.setValueIfAttributeDefined(defBuilder, allocElement, "memory");
YarnNamespaceUtils.setValueIfAttributeDefined(defBuilder, allocElement, "priority");
}
AbstractBeanDefinition beanDef = defBuilder.getBeanDefinition();
String beanName = BeanDefinitionReaderUtils.generateBeanName(beanDef, parserContext.getRegistry());
parserContext.registerBeanComponent(new BeanComponentDefinition(beanDef, beanName));
builder.addPropertyReference("allocator", beanName);
// launcher - for now, defaulting to DefaultContainerLauncher