Spring for Apache Hadoop

org.springframework.yarn.config.annotation.builders
Interface YarnAppmasterConfigurer

All Known Implementing Classes:
YarnAppmasterBuilder

public interface YarnAppmasterConfigurer

YarnAppmasterConfigure is an interface for YarnAppmasterBuilder which is exposed to user via SpringYarnConfigurerAdapter.

Typically configuration is shown below.

 @Configuration
 @EnableYarn(enable=Enable.APPMASTER)
 static class Config extends SpringYarnConfigurerAdapter {

   @Override
   public void configure(YarnAppmasterConfigure master) throws Exception {
     master
       .appmasterClass(MyAppmaster.class)
       .withContainerRunner();
   }

 }
 

Author:
Janne Valkealahti

Method Summary
 YarnAppmasterConfigurer appmasterClass(java.lang.Class<? extends YarnAppmaster> clazz)
          Specify a YarnAppmaster class.
 YarnAppmasterConfigurer appmasterClass(java.lang.String clazz)
          Specify a YarnAppmaster as a fully qualified class name.
 YarnAppmasterConfigurer containerCommands(java.lang.String... commands)
          Specify a raw array of commands used to start a container.
 MasterContainerAllocatorConfigurer withContainerAllocator()
          Specify a container allocator for Appmaster.
 MasterContainerRunnerConfigurer withContainerRunner()
          Specify a container runner for Appmaster.
 

Method Detail

withContainerRunner

MasterContainerRunnerConfigurer withContainerRunner()
                                                    throws java.lang.Exception
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>
 

Returns:
MasterContainerRunnerConfigurer for chaining
Throws:
java.lang.Exception

withContainerAllocator

MasterContainerAllocatorConfigurer withContainerAllocator()
                                                          throws java.lang.Exception
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>
 

Returns:
MasterContainerAllocatorConfigurer for chaining
Throws:
java.lang.Exception

containerCommands

YarnAppmasterConfigurer containerCommands(java.lang.String... commands)
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>
 

Parameters:
commands - The Yarn container commands
Returns:
YarnAppmasterConfigurer for chaining

appmasterClass

YarnAppmasterConfigurer appmasterClass(java.lang.Class<? extends YarnAppmaster> clazz)
Specify a YarnAppmaster class.

JavaConfig:

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

XML:

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

Parameters:
clazz - The Yarn appmaster class
Returns:
YarnAppmasterConfigurer for chaining

appmasterClass

YarnAppmasterConfigurer appmasterClass(java.lang.String clazz)
Specify a YarnAppmaster as a fully qualified class name.

JavaConfig:

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

XML:

No equivalent

Parameters:
clazz - The Yarn appmaster class
Returns:
YarnAppmasterConfigurer for chaining

Spring for Apache Hadoop