Spring for Apache Hadoop

org.springframework.yarn.config.annotation.builders
Class YarnAppmasterBuilder

java.lang.Object
  extended by org.springframework.data.hadoop.config.common.annotation.AbstractAnnotationBuilder<O>
      extended by org.springframework.data.hadoop.config.common.annotation.AbstractConfiguredAnnotationBuilder<YarnAppmaster,YarnAppmasterConfigurer,YarnAppmasterBuilder>
          extended by org.springframework.yarn.config.annotation.builders.YarnAppmasterBuilder
All Implemented Interfaces:
AnnotationBuilder<YarnAppmaster>, YarnAppmasterConfigurer

public final class YarnAppmasterBuilder
extends AbstractConfiguredAnnotationBuilder<YarnAppmaster,YarnAppmasterConfigurer,YarnAppmasterBuilder>
implements YarnAppmasterConfigurer

Author:
Janne Valkealahti

Constructor Summary
YarnAppmasterBuilder()
           
YarnAppmasterBuilder(ObjectPostProcessor<java.lang.Object> objectPostProcessor)
           
 
Method Summary
 YarnAppmasterBuilder appmasterClass(java.lang.Class<? extends YarnAppmaster> clazz)
          Specify a YarnAppmaster class.
 YarnAppmasterBuilder appmasterClass(java.lang.String clazz)
          Specify a YarnAppmaster as a fully qualified class name.
 void configuration(org.apache.hadoop.conf.Configuration configuration)
           
 YarnAppmasterBuilder containerCommands(java.lang.String... commands)
          Specify a raw array of commands used to start a container.
protected  YarnAppmaster performBuild()
          Subclasses must implement this method to build the object that is being returned.
 void setContainerAllocator(ContainerAllocator containerAllocator)
           
 void setEnvironment(java.util.Map<java.lang.String,java.lang.String> environment)
           
 void setResourceLocalizer(ResourceLocalizer resourceLocalizer)
           
 MasterContainerAllocatorConfigurer withContainerAllocator()
          Specify a container allocator for Appmaster.
 MasterContainerRunnerConfigurer withContainerRunner()
          Specify a container runner for Appmaster.
 
Methods inherited from class org.springframework.data.hadoop.config.common.annotation.AbstractConfiguredAnnotationBuilder
apply, apply, beforeConfigureMains, beforeConfigurePosts, beforeInit, doBuild, getConfigurer, getConfigurers, getOrApply, getOrBuild, getSharedObject, getSharedObjects, objectPostProcessor, postProcess, removeConfigurer, removeConfigurers, setSharedObject
 
Methods inherited from class org.springframework.data.hadoop.config.common.annotation.AbstractAnnotationBuilder
build, getObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

YarnAppmasterBuilder

public YarnAppmasterBuilder()

YarnAppmasterBuilder

public YarnAppmasterBuilder(ObjectPostProcessor<java.lang.Object> objectPostProcessor)
Method Detail

performBuild

protected YarnAppmaster performBuild()
                              throws java.lang.Exception
Description copied from class: AbstractConfiguredAnnotationBuilder
Subclasses must implement this method to build the object that is being returned.

Specified by:
performBuild in class AbstractConfiguredAnnotationBuilder<YarnAppmaster,YarnAppmasterConfigurer,YarnAppmasterBuilder>
Returns:
Object build by this builder
Throws:
java.lang.Exception

withContainerRunner

public MasterContainerRunnerConfigurer withContainerRunner()
                                                    throws java.lang.Exception
Description copied from interface: YarnAppmasterConfigurer
Specify a container runner for Appmaster. Applies a new DefaultMasterContainerRunnerConfigurer into a current builder.

JavaConfig:


 public void configure(YarnAppmasterConfigure master) throws Exception {
   Properties properties = new Properties();
   properties.setProperty("foo1", "bar1");
   master
     .withContainerRunner()
       .arguments(properties)
       .argument("foo2", "bar2");
 }
 

XML:

 <util:properties id="arguments">
   <prop key="foo1">bar1</prop>
   <prop key="foo2">bar2</prop>
 </util:properties>

 <yarn:master>
   <yarn:container-runner arguments="arguments"/>
 </yarn:master>
 

Specified by:
withContainerRunner in interface YarnAppmasterConfigurer
Returns:
MasterContainerRunnerConfigurer for chaining
Throws:
java.lang.Exception

withContainerAllocator

public MasterContainerAllocatorConfigurer withContainerAllocator()
                                                          throws java.lang.Exception
Description copied from interface: YarnAppmasterConfigurer
Specify a container allocator for Appmaster. Applies a new DefaultMasterContainerAllocatorConfigurer into a current builder.

JavaConfig:


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

XML:

 <yarn:master>
   <yarn:container-allocator priority="0" virtualcores="1" memory="1024"/>
 </yarn:master>
 

Specified by:
withContainerAllocator in interface YarnAppmasterConfigurer
Returns:
MasterContainerAllocatorConfigurer for chaining
Throws:
java.lang.Exception

configuration

public void configuration(org.apache.hadoop.conf.Configuration configuration)

setResourceLocalizer

public void setResourceLocalizer(ResourceLocalizer resourceLocalizer)

setContainerAllocator

public void setContainerAllocator(ContainerAllocator containerAllocator)

setEnvironment

public void setEnvironment(java.util.Map<java.lang.String,java.lang.String> environment)

appmasterClass

public YarnAppmasterBuilder appmasterClass(java.lang.Class<? extends YarnAppmaster> clazz)
Description copied from interface: YarnAppmasterConfigurer
Specify a YarnAppmaster class.

JavaConfig:

 public void configure(YarnAppmasterConfigure master) throws Exception {
   master
     .appmasterClass(MyYarnAppmaster.class);
 }
 

XML:

 <yarn:master appmaster-class="com.example.MyYarnAppmaster"/>
 

Specified by:
appmasterClass in interface YarnAppmasterConfigurer
Parameters:
clazz - The Yarn appmaster class
Returns:
YarnAppmasterConfigurer for chaining

appmasterClass

public YarnAppmasterBuilder appmasterClass(java.lang.String clazz)
Description copied from interface: YarnAppmasterConfigurer
Specify a YarnAppmaster as a fully qualified class name.

JavaConfig:

 public void configure(YarnAppmasterConfigure master) throws Exception {
   master
     .appmasterClass(MyYarnAppmaster.class);
 }
 

XML:

No equivalent

Specified by:
appmasterClass in interface YarnAppmasterConfigurer
Parameters:
clazz - The Yarn appmaster class
Returns:
YarnAppmasterConfigurer for chaining

containerCommands

public YarnAppmasterBuilder containerCommands(java.lang.String... commands)
Description copied from interface: YarnAppmasterConfigurer
Specify a raw array of commands used to start a container.

JavaConfig:

 public void configure(YarnAppmasterConfigure master) throws Exception {
   master
     .containerCommands("date", "1>/Container.stdout", "2>/Container.stderr");
 }
 

XML:

 <yarn:master>
   <yarn:container-command>
     <![CDATA[
     date
     1>/Container.stdout
     2>/Container.stderr
     ]]>
   </yarn:container-command>
 </yarn:master>
 

Specified by:
containerCommands in interface YarnAppmasterConfigurer
Parameters:
commands - The Yarn container commands
Returns:
YarnAppmasterConfigurer for chaining

Spring for Apache Hadoop