public final class YarnEnvironmentBuilder extends AbstractConfiguredAnnotationBuilder<java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>>,YarnEnvironmentConfigurer,YarnEnvironmentBuilder> implements PropertiesConfigurerAware, YarnEnvironmentConfigurer
AnnotationBuilder
for Yarn environment.Constructor and Description |
---|
YarnEnvironmentBuilder()
Instantiates a new yarn environment builder.
|
Modifier and Type | Method and Description |
---|---|
void |
addClasspathEntries(java.lang.String id,
java.util.ArrayList<java.lang.String> classpathEntries)
Adds the classpath entries.
|
void |
configuration(org.apache.hadoop.conf.Configuration configuration)
Sets the yarn configuration.
|
void |
configureProperties(java.util.Properties properties)
Configure
Properties . |
YarnEnvironmentConfigurer |
entry(java.lang.String key,
java.lang.String value)
Specify an environment variable.
|
YarnEnvironmentConfigurer |
entry(java.lang.String id,
java.lang.String key,
java.lang.String value)
Specify an environment variable using an identifier.
|
YarnEnvironmentConfigurer |
includeLocalSystemEnv(boolean includeLocalSystemEnv)
Specify if existing system environment variables should
be included automatically.
|
YarnEnvironmentConfigurer |
includeLocalSystemEnv(java.lang.String id,
boolean includeLocalSystemEnv)
Specify if existing system environment variables should
be included automatically with an identifier.
|
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> |
performBuild()
Subclasses must implement this method to build the object that is being returned.
|
YarnEnvironmentConfigurer |
propertiesLocation(java.lang.String... locations)
Specify properties locations.
|
YarnEnvironmentConfigurer |
propertiesLocationId(java.lang.String id,
java.lang.String[] locations)
Specify properties locations with an identifier.
|
void |
setDefaultMapreduceAppClasspath(java.lang.String id,
java.lang.String defaultMapreduceAppClasspath)
Sets the default mr app classpath.
|
void |
setDefaultYarnAppClasspath(java.lang.String id,
java.lang.String defaultYarnAppClasspath)
Sets the default yarn app classpath.
|
void |
setDelimiter(java.lang.String id,
java.lang.String delimiter)
Sets the delimiter.
|
void |
setIncludeBaseDirectory(java.lang.String id,
boolean includeBaseDirectory)
Sets the include base directory.
|
void |
setUseDefaultMapreduceClasspath(java.lang.String id,
boolean useDefaultClasspath)
Sets the default classpath.
|
void |
setUseDefaultYarnClasspath(java.lang.String id,
boolean useDefaultClasspath)
Sets the default classpath.
|
EnvironmentClasspathConfigurer |
withClasspath()
Specify a classpath environment variable.
|
EnvironmentClasspathConfigurer |
withClasspath(java.lang.String id)
Specify a classpath environment variable using an identifier.
|
PropertiesConfigurer<YarnEnvironmentConfigurer> |
withProperties()
Specify properties with a
PropertiesConfigurer . |
PropertiesConfigurer<YarnEnvironmentConfigurer> |
withProperties(java.lang.String id)
Specify properties with a
PropertiesConfigurer
with an identifier. |
apply, apply, beforeConfigureMains, beforeConfigurePosts, beforeInit, doBuild, getConfigurer, getConfigurers, getOrApply, getOrBuild, getSharedObject, getSharedObjects, objectPostProcessor, postProcess, removeConfigurer, removeConfigurers, setSharedObject
build, getObject
public YarnEnvironmentBuilder()
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> performBuild() throws java.lang.Exception
AbstractConfiguredAnnotationBuilder
performBuild
in class AbstractConfiguredAnnotationBuilder<java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>>,YarnEnvironmentConfigurer,YarnEnvironmentBuilder>
java.lang.Exception
public void configureProperties(java.util.Properties properties)
PropertiesConfigurerAware
Properties
.configureProperties
in interface PropertiesConfigurerAware
properties
- the propertiespublic EnvironmentClasspathConfigurer withClasspath() throws java.lang.Exception
YarnEnvironmentConfigurer
Applies a new DefaultEnvironmentClasspathConfigurer
into current
builder. Equivalents between JavaConfig and XML are shown below.
JavaConfig:
public void configure(YarnEnvironmentBuilder environment) throws Exception { environment .withClasspath() .entry("cpEntry1") .entry("cpEntry2") .useDefaultYarnClasspath(true); }
<yarn:environment> <yarn:classpath use-yarn-app-classpath="true" delimiter=":"> cpEntry1 cpEntry2 </yarn:classpath> </yarn:environment>
withClasspath
in interface YarnEnvironmentConfigurer
EnvironmentClasspathConfigurer
for classpathjava.lang.Exception
- if error occurredpublic EnvironmentClasspathConfigurer withClasspath(java.lang.String id) throws java.lang.Exception
YarnEnvironmentConfigurer
withClasspath
in interface YarnEnvironmentConfigurer
id
- the identifierEnvironmentClasspathConfigurer
for classpathjava.lang.Exception
- if error occurredYarnEnvironmentConfigurer.withClasspath()
public YarnEnvironmentConfigurer entry(java.lang.String key, java.lang.String value)
YarnEnvironmentConfigurer
public void configure(YarnEnvironmentConfigure environment) throws Exception { environment .entry("myKey1","myValue1") .entry("myKey2","myValue2"); }
<yarn:environment> myKey1=myValue1 myKey2=myValue2 </yarn:environment>
entry
in interface YarnEnvironmentConfigurer
key
- The environment keyvalue
- The environment valueYarnEnvironmentConfigurer
for chainingpublic YarnEnvironmentConfigurer entry(java.lang.String id, java.lang.String key, java.lang.String value)
YarnEnvironmentConfigurer
entry
in interface YarnEnvironmentConfigurer
id
- the identifierkey
- The environment keyvalue
- The environment valueYarnEnvironmentConfigurer
for chainingYarnEnvironmentConfigurer.entry(String, String)
public YarnEnvironmentConfigurer propertiesLocation(java.lang.String... locations) throws java.io.IOException
YarnEnvironmentConfigurer
public void configure(YarnEnvironmentConfigure environment) throws Exception { environment .entry("myKey1","myValue1") .entry("myKey2","myValue2") .propertiesLocation("cfg-1.properties", "cfg-2.properties"); }
<yarn:environment properties-location="cfg-1.properties, cfg-2.properties"> myKey1=myValue1 myKey2=myValue2 </yarn:environment>
propertiesLocation
in interface YarnEnvironmentConfigurer
locations
- The properties file locationsYarnEnvironmentConfigurer
for chainingjava.io.IOException
- if error occurredpublic YarnEnvironmentConfigurer propertiesLocationId(java.lang.String id, java.lang.String[] locations) throws java.io.IOException
YarnEnvironmentConfigurer
propertiesLocationId
in interface YarnEnvironmentConfigurer
id
- the identifierlocations
- the properties file locationsYarnEnvironmentConfigurer
for chainingjava.io.IOException
- if error occurredYarnEnvironmentConfigurer.propertiesLocation(String...)
public YarnEnvironmentConfigurer includeLocalSystemEnv(boolean includeLocalSystemEnv)
YarnEnvironmentConfigurer
public void configure(YarnEnvironmentConfigure environment) throws Exception { environment .includeLocalSystemEnv(false); }
<yarn:environment include-local-system-env="false"/>
includeLocalSystemEnv
in interface YarnEnvironmentConfigurer
includeLocalSystemEnv
- if system env variables should be includedYarnEnvironmentConfigurer
for chainingpublic YarnEnvironmentConfigurer includeLocalSystemEnv(java.lang.String id, boolean includeLocalSystemEnv)
YarnEnvironmentConfigurer
includeLocalSystemEnv
in interface YarnEnvironmentConfigurer
id
- the identifierincludeLocalSystemEnv
- if system env variables should be includedYarnEnvironmentConfigurer
for chainingYarnEnvironmentConfigurer.includeLocalSystemEnv(boolean)
public PropertiesConfigurer<YarnEnvironmentConfigurer> withProperties() throws java.lang.Exception
YarnEnvironmentConfigurer
PropertiesConfigurer
.
public void configure(YarnEnvironmentConfigure environment) throws Exception { Properties props = new Properties(); environment .withProperties() .properties(props) .property("myKey1", ",myValue1") .and(); }
<util:properties id="props" location="props.properties"/> <prop key="myKey1">myValue1</prop> </util:properties> <yarn:environment properties-ref="props"/>
withProperties
in interface YarnEnvironmentConfigurer
PropertiesConfigurer
for chainingjava.lang.Exception
- if error occurredpublic PropertiesConfigurer<YarnEnvironmentConfigurer> withProperties(java.lang.String id) throws java.lang.Exception
YarnEnvironmentConfigurer
PropertiesConfigurer
with an identifier.withProperties
in interface YarnEnvironmentConfigurer
id
- the identifierPropertiesConfigurer
for chainingjava.lang.Exception
- if error occurredYarnEnvironmentConfigurer.withProperties()
public void addClasspathEntries(java.lang.String id, java.util.ArrayList<java.lang.String> classpathEntries)
id
- the idclasspathEntries
- the classpath entriespublic void configuration(org.apache.hadoop.conf.Configuration configuration)
configuration
- the yarn configurationpublic void setUseDefaultYarnClasspath(java.lang.String id, boolean useDefaultClasspath)
id
- the iduseDefaultClasspath
- the new default classpathpublic void setUseDefaultMapreduceClasspath(java.lang.String id, boolean useDefaultClasspath)
id
- the iduseDefaultClasspath
- the new default classpathpublic void setIncludeBaseDirectory(java.lang.String id, boolean includeBaseDirectory)
id
- the idincludeBaseDirectory
- the new include base directorypublic void setDelimiter(java.lang.String id, java.lang.String delimiter)
id
- the iddelimiter
- the new delimiterpublic void setDefaultYarnAppClasspath(java.lang.String id, java.lang.String defaultYarnAppClasspath)
id
- the iddefaultYarnAppClasspath
- the new default yarn app classpathpublic void setDefaultMapreduceAppClasspath(java.lang.String id, java.lang.String defaultMapreduceAppClasspath)
id
- the iddefaultMapreduceAppClasspath
- the new default mr app classpath