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
defBuilder = BeanDefinitionBuilder.genericBeanDefinition(DefaultContainerLauncher.class);
Element launchElement = DomUtils.getChildElementByTagName(element, "container-launcher");
if(launchElement != null) {
YarnNamespaceUtils.setValueIfAttributeDefined(defBuilder, allocElement, "username");
}
YarnNamespaceUtils.setReferenceIfAttributeDefined(defBuilder, element, "configuration", YarnSystemConstants.DEFAULT_ID_CONFIGURATION);
YarnNamespaceUtils.setReferenceIfAttributeDefined(defBuilder, element, "environment", YarnSystemConstants.DEFAULT_ID_ENVIRONMENT);
YarnNamespaceUtils.setReferenceIfAttributeDefined(defBuilder, element, "resource-localizer", YarnSystemConstants.DEFAULT_ID_LOCAL_RESOURCES);
beanDef = defBuilder.getBeanDefinition();
beanName = BeanDefinitionReaderUtils.generateBeanName(beanDef, parserContext.getRegistry());
parserContext.registerBeanComponent(new BeanComponentDefinition(beanDef, beanName));
builder.addPropertyReference("launcher", beanName);
// monitor - for now, defaulting to DefaultContainerMonitor
defBuilder = BeanDefinitionBuilder.genericBeanDefinition(DefaultContainerMonitor.class);
beanDef = defBuilder.getBeanDefinition();
beanName = BeanDefinitionReaderUtils.generateBeanName(beanDef, parserContext.getRegistry());
parserContext.registerBeanComponent(new BeanComponentDefinition(beanDef, beanName));
builder.addPropertyReference("monitor", beanName);
// yarn specific job launcher
defBuilder = BeanDefinitionBuilder.genericBeanDefinition(YarnJobLauncher.class);
YarnNamespaceUtils.setReferenceIfAttributeDefined(defBuilder, element, "job-launcher");
YarnNamespaceUtils.setCSVReferenceProperty(element, defBuilder, "jobs", "jobs");
YarnNamespaceUtils.setValueIfAttributeDefined(defBuilder, element, "job-name", false, "job");
beanDef = defBuilder.getBeanDefinition();
beanName = BeanDefinitionReaderUtils.generateBeanName(beanDef, parserContext.getRegistry());
parserContext.registerBeanComponent(new BeanComponentDefinition(beanDef, beanName));
builder.addPropertyReference("yarnJobLauncher", beanName);
// for appmaster bean
YarnNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "resource-localizer", YarnSystemConstants.DEFAULT_ID_LOCAL_RESOURCES);
YarnNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "configuration", YarnSystemConstants.DEFAULT_ID_CONFIGURATION);