Spring for Apache Hadoop

org.springframework.yarn.config.annotation.configurers
Class DefaultMasterContainerAllocatorConfigurer

java.lang.Object
  extended by org.springframework.data.hadoop.config.common.annotation.AnnotationConfigurerAdapter<YarnAppmaster,YarnAppmasterConfigurer,YarnAppmasterBuilder>
      extended by org.springframework.yarn.config.annotation.configurers.DefaultMasterContainerAllocatorConfigurer
All Implemented Interfaces:
AnnotationConfigurer<YarnAppmaster,YarnAppmasterBuilder>, AnnotationConfigurerBuilder<YarnAppmasterConfigurer>, MasterContainerAllocatorConfigurer

public class DefaultMasterContainerAllocatorConfigurer
extends AnnotationConfigurerAdapter<YarnAppmaster,YarnAppmasterConfigurer,YarnAppmasterBuilder>
implements MasterContainerAllocatorConfigurer


Constructor Summary
DefaultMasterContainerAllocatorConfigurer()
           
 
Method Summary
 void configure(YarnAppmasterBuilder builder)
          Configure the AnnotationBuilder by setting the necessary properties on the AnnotationBuilder.
 MasterContainerAllocatorConfigurer memory(int memory)
          Specify a container memory for ContainerAllocator.
 MasterContainerAllocatorConfigurer memory(java.lang.String memory)
          Specify a container memory for ContainerAllocator.
 MasterContainerAllocatorConfigurer priority(java.lang.Integer priority)
          Specify a container priority for ContainerAllocator.
 MasterContainerAllocatorConfigurer virtualCores(java.lang.Integer virtualCores)
          Specify a container virtual cores for ContainerAllocator.
 
Methods inherited from class org.springframework.data.hadoop.config.common.annotation.AnnotationConfigurerAdapter
addObjectPostProcessor, and, getBuilder, init, isAssignable, setBuilder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.data.hadoop.config.common.annotation.AnnotationConfigurerBuilder
and
 

Constructor Detail

DefaultMasterContainerAllocatorConfigurer

public DefaultMasterContainerAllocatorConfigurer()
Method Detail

configure

public void configure(YarnAppmasterBuilder builder)
               throws java.lang.Exception
Description copied from interface: AnnotationConfigurer
Configure the AnnotationBuilder by setting the necessary properties on the AnnotationBuilder.

Specified by:
configure in interface AnnotationConfigurer<YarnAppmaster,YarnAppmasterBuilder>
Overrides:
configure in class AnnotationConfigurerAdapter<YarnAppmaster,YarnAppmasterConfigurer,YarnAppmasterBuilder>
Parameters:
builder - the builder
Throws:
java.lang.Exception - if error occurred

priority

public MasterContainerAllocatorConfigurer priority(java.lang.Integer priority)
Description copied from interface: MasterContainerAllocatorConfigurer
Specify a container priority for ContainerAllocator.

JavaConfig:


 public void configure(YarnAppmasterConfigure master) throws Exception {
   master
     .withContainerAllocator()
       .priority(0);
 }
 

XML:

 <yarn:master>
   <yarn:container-allocator priority="0"/>
 </yarn:master>
 

Specified by:
priority in interface MasterContainerAllocatorConfigurer
Parameters:
priority - the priority
Returns:
MasterContainerAllocatorConfigurer for chaining

virtualCores

public MasterContainerAllocatorConfigurer virtualCores(java.lang.Integer virtualCores)
Description copied from interface: MasterContainerAllocatorConfigurer
Specify a container virtual cores for ContainerAllocator.

JavaConfig:


 public void configure(YarnAppmasterConfigure master) throws Exception {
   master
     .withContainerAllocator()
       .virtualCores(1);
 }
 

XML:

 <yarn:master>
   <yarn:container-allocator virtualcores="1"/>
 </yarn:master>
 

Specified by:
virtualCores in interface MasterContainerAllocatorConfigurer
Parameters:
virtualCores - the virtual cores
Returns:
MasterContainerAllocatorConfigurer for chaining

memory

public MasterContainerAllocatorConfigurer memory(java.lang.String memory)
Description copied from interface: MasterContainerAllocatorConfigurer
Specify a container memory for ContainerAllocator. The memory argument is given as MegaBytes if value is a plain number. Shortcuts like 1G and 500M can be used which translates to 1024 and 500 respectively.

This method is equivalent to #memory(int) so that argument can be given as a String.

NOTE: be careful not to use a too low settings like 1000K or 1000B because those are rounded down to full MBs and thus becomes a zero. Also too high values may make resource allocation to behave badly.

JavaConfig:


 public void configure(YarnAppmasterConfigure master) throws Exception {
   master
     .withContainerAllocator()
       .memory("1G");
 }
 

XML:

 <yarn:master>
   <yarn:container-allocator memory="1024"/>
 </yarn:master>
 

Specified by:
memory in interface MasterContainerAllocatorConfigurer
Parameters:
memory - the memory
Returns:
MasterContainerAllocatorConfigurer for chaining

memory

public MasterContainerAllocatorConfigurer memory(int memory)
Description copied from interface: MasterContainerAllocatorConfigurer
Specify a container memory for ContainerAllocator.

JavaConfig:


 public void configure(YarnAppmasterConfigure master) throws Exception {
   master
     .withContainerAllocator()
       .memory(1024);
 }
 

XML:

 <yarn:master>
   <yarn:container-allocator memory="1024"/>
 </yarn:master>
 

Specified by:
memory in interface MasterContainerAllocatorConfigurer
Parameters:
memory - the memory
Returns:
MasterContainerAllocatorConfigurer for chaining
See Also:
MasterContainerAllocatorConfigurer.memory(String)

Spring for Apache Hadoop