Spring for Apache Hadoop

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

All Known Implementing Classes:
YarnConfigBuilder

public interface YarnConfigConfigurer

YarnConfigConfigure is an interface for YarnConfigBuilder which is exposed to user via SpringYarnConfigurerAdapter.

Typically configuration is shown below.

 @Configuration
 @EnableYarn
 static class Config extends SpringYarnConfigurerAdapter {

   @Override
   public void configure(YarnConfigConfigure config) throws Exception {
     config
       .fileSystemUri("hdfs://foo.uri")
       .withResources()
         .resource("classpath:/test-site-1.xml")
         .resource("classpath:/test-site-2.xml")
         .and()
       .withProperties()
         .property("foo", "jee");
   }

 }
 

Author:
Janne Valkealahti

Method Summary
 YarnConfigConfigurer fileSystemUri(java.lang.String uri)
          Specify a Hdfs file system uri.
 YarnConfigConfigurer loadDefaults(boolean loadDefaults)
          Specify if Hadoop Configuration is initially based on default values.
 YarnConfigConfigurer resourceManagerAddress(java.lang.String address)
          Specify a Yarn resource manager address.
 YarnConfigConfigurer schedulerAddress(java.lang.String address)
          Specify a Yarn resource manager scheduler address.
 PropertiesConfigurer<YarnConfigConfigurer> withProperties()
          Specify configuration options as properties with a PropertiesConfigurer.
 ResourceConfigurer<YarnConfigConfigurer> withResources()
          Specify configuration options as resource properties with a ResourceConfigurer.
 

Method Detail

withResources

ResourceConfigurer<YarnConfigConfigurer> withResources()
                                                       throws java.lang.Exception
Specify configuration options as resource properties with a ResourceConfigurer.

JavaConfig:

 public void configure(YarnConfigConfigure config) throws Exception {
   Properties props = new Properties();
   config
     .withResources()
       .resource("cfg-1.properties")
       .resource("cfg-2.properties")
       .and();
 }
 

XML:

 <yarn:configuration properties-location="cfg-1.properties, cfg-2.properties"/>
 

Returns:
ResourceConfigurer for chaining
Throws:
java.lang.Exception - if error occurred

withProperties

PropertiesConfigurer<YarnConfigConfigurer> withProperties()
                                                          throws java.lang.Exception
Specify configuration options as properties with a PropertiesConfigurer.

JavaConfig:

 public void configure(YarnConfigConfigure config) throws Exception {
   Properties props = new Properties();
   config
     .withProperties()
       .properties(props)
       .property("myKey1", ",myValue1")
       .and();
 }
 

XML:

 <util:properties id="props" location="props.properties"/>
   myValue1
 </util:properties>
 <yarn:configuration properties-ref="props"/>
 

Returns:
PropertiesConfigurer for chaining
Throws:
java.lang.Exception - if error occurred

fileSystemUri

YarnConfigConfigurer fileSystemUri(java.lang.String uri)
Specify a Hdfs file system uri.

JavaConfig:

 public void configure(YarnConfigConfigure config) throws Exception {
   config
     .fileSystemUri("hdfs://myhost:8020");
 }
 

XML:

 <yarn:configuration fs-uri="hdfs://myhost:8020"/>
 

Parameters:
uri - The Hdfs uri
Returns:
YarnConfigConfigurer for chaining

resourceManagerAddress

YarnConfigConfigurer resourceManagerAddress(java.lang.String address)
Specify a Yarn resource manager address.

JavaConfig:

 public void configure(YarnConfigConfigure config) throws Exception {
   config
     .resourceManagerAddress("myRmHost:8032");
 }
 

XML:

 <yarn:configuration rm-address="myRmHost:8032"/>
 

Parameters:
address - The Yarn resource manager address
Returns:
YarnConfigConfigurer for chaining

schedulerAddress

YarnConfigConfigurer schedulerAddress(java.lang.String address)
Specify a Yarn resource manager scheduler address.

JavaConfig:

 public void configure(YarnConfigConfigure config) throws Exception {
   config
     .schedulerAddress("myRmHost:8030");
 }
 

XML:

 <yarn:configuration scheduler-address="myRmHost:8030"/>
 

Parameters:
address - The Yarn resource manager scheduler address
Returns:
YarnConfigConfigurer for chaining

loadDefaults

YarnConfigConfigurer loadDefaults(boolean loadDefaults)
Specify if Hadoop Configuration is initially based on default values. Default is true.

JavaConfig:

 public void configure(YarnConfigConfigure config) throws Exception {
   config
     .loadDefaults(true);
 }
 

XML:

No equivalent

Parameters:
loadDefaults - The flag if defaults should be loaded
Returns:
YarnConfigConfigurer for chaining

Spring for Apache Hadoop