private final List<DefaultMasterContainerAllocatorCollectionConfigurer> collectionConfigurers =
new ArrayList<DefaultMasterContainerAllocatorCollectionConfigurer>();
@Override
public void configure(YarnAppmasterBuilder builder) throws Exception {
DefaultContainerAllocator allocator = new DefaultContainerAllocator();
if (priority != null) {
allocator.setPriority(priority);
}
if (virtualCores != null) {
allocator.setVirtualcores(virtualCores);
}
if (memory != null) {
allocator.setMemory(ParsingUtils.parseBytesAsMegs(memory));
}
allocator.setLocality(locality);
for (DefaultMasterContainerAllocatorCollectionConfigurer configurer : collectionConfigurers) {
allocator.setAllocationValues(configurer.id, configurer.priority, configurer.virtualCores,
StringUtils.hasText(configurer.memory) ? ParsingUtils.parseBytesAsMegs(configurer.memory) : null,
configurer.locality);
}
builder.setContainerAllocator(allocator);