public class YarnClientBuilder extends AbstractConfiguredAnnotationBuilder<YarnClient,YarnClientConfigurer,YarnClientBuilder> implements YarnClientConfigurer
| Constructor and Description |
|---|
YarnClientBuilder()
Instantiates a new yarn client builder.
|
| Modifier and Type | Method and Description |
|---|---|
YarnClientConfigurer |
appName(java.lang.String appName)
Specify a yarn application name.
|
YarnClientConfigurer |
appType(java.lang.String appType)
Specify a yarn application type.
|
YarnClientConfigurer |
clientClass(java.lang.Class<? extends YarnClient> clazz)
Specify a
YarnClient class. |
YarnClientConfigurer |
clientClass(java.lang.String clazz)
Specify a
YarnClient as a fully qualified class name. |
void |
configuration(org.apache.hadoop.conf.Configuration configuration) |
YarnClientConfigurer |
masterCommands(java.lang.String... commands)
Specify a raw array of commands used to start an application master.
|
YarnClientConfigurer |
memory(int memory)
Specify a yarn application containers memory reservation.
|
YarnClientConfigurer |
memory(java.lang.String memory)
Specify a yarn application containers memory reservation.
|
protected YarnClient |
performBuild()
Subclasses must implement this method to build the object that is being returned.
|
YarnClientConfigurer |
priority(java.lang.Integer priority)
Specify a yarn application priority.
|
YarnClientConfigurer |
queue(java.lang.String queue)
Specify a yarn application submission queue.
|
void |
setCommands(java.lang.String... commands) |
void |
setEnvironment(java.util.Map<java.lang.String,java.lang.String> environment) |
void |
setResourceLocalizer(ResourceLocalizer resourceLocalizer) |
YarnClientConfigurer |
virtualCores(java.lang.Integer virtualCores)
Specify a yarn application virtual core resource count.
|
DefaultClientMasterRunnerConfigurer |
withMasterRunner()
Add commands for starting
YarnAppmaster. |
apply, apply, beforeConfigureMains, beforeConfigurePosts, beforeInit, doBuild, getConfigurer, getConfigurers, getOrApply, getOrBuild, getSharedObject, getSharedObjects, objectPostProcessor, postProcess, removeConfigurer, removeConfigurers, setSharedObjectbuild, getObjectpublic YarnClientBuilder()
protected YarnClient performBuild() throws java.lang.Exception
AbstractConfiguredAnnotationBuilderperformBuild in class AbstractConfiguredAnnotationBuilder<YarnClient,YarnClientConfigurer,YarnClientBuilder>java.lang.Exceptionpublic DefaultClientMasterRunnerConfigurer withMasterRunner() throws java.lang.Exception
YarnAppmaster.withMasterRunner in interface YarnClientConfigurerjava.lang.Exception - the exceptionpublic YarnClientConfigurer appName(java.lang.String appName)
YarnClientConfigurer
public void configure(YarnClientConfigure client) throws Exception {
client
.appName("myAppName");
}
<yarn:client app-name="myAppName"/>
appName in interface YarnClientConfigurerappName - The Yarn application nameYarnClientConfigurer for chainingpublic YarnClientConfigurer appType(java.lang.String appType)
YarnClientConfigurerMAPREDUCE and other
applications defaults to YARN.
public void configure(YarnClientConfigure client) throws Exception {
client
.appType("BOOT");
}
appType in interface YarnClientConfigurerappType - The Yarn application typeYarnClientConfigurer for chainingpublic YarnClientConfigurer masterCommands(java.lang.String... commands)
YarnClientConfigurer
public void configure(YarnClientConfigure client) throws Exception {
client
.masterCommands("java -jar MyApp.jar", "1><LOG_DIR>/Appmaster.stdout", "2><LOG_DIR>/Appmaster.stderr");
}
<yarn:client>
<yarn:master-command>
<![CDATA[
java -jar MyApp.jar
1><LOG_DIR>/Appmaster.stdout
2><LOG_DIR>/Appmaster.stderr
]]>
</yarn:master-command>
</yarn:client>
masterCommands in interface YarnClientConfigurercommands - The Yarn container commandsYarnAppmasterConfigurer for chainingpublic YarnClientConfigurer priority(java.lang.Integer priority)
YarnClientConfigurer
public void configure(YarnClientConfigure client) throws Exception {
client
.priority(0);
}
<yarn:client priority="0"/>
priority in interface YarnClientConfigurerpriority - The Yarn application priorityYarnClientConfigurer for chainingpublic YarnClientConfigurer queue(java.lang.String queue)
YarnClientConfigurer
public void configure(YarnClientConfigure client) throws Exception {
client
.queue("default");
}
<yarn:client queue="default"/>
queue in interface YarnClientConfigurerqueue - The Yarn application submission queueYarnClientConfigurer for chainingpublic YarnClientConfigurer memory(int memory)
YarnClientConfigurermemory argument is given as MegaBytes.
public void configure(YarnClientConfigure client) throws Exception {
client
.memory(1024);
}
<yarn:client memory="1024"/>
memory in interface YarnClientConfigurermemory - The Yarn application containers memory reservationYarnClientConfigurer for chainingYarnClientConfigurer.memory(String)public YarnClientConfigurer memory(java.lang.String memory)
YarnClientConfigurermemory 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(YarnClientConfigure client) throws Exception {
client
.memory("1G");
}
<yarn:client memory="1024"/>
memory in interface YarnClientConfigurermemory - The Yarn application containers memory reservationYarnClientConfigurer for chainingpublic YarnClientConfigurer virtualCores(java.lang.Integer virtualCores)
YarnClientConfigurer
public void configure(YarnClientConfigure client) throws Exception {
client
.virtualCores(1);
}
<yarn:client virtualcores="1"/>
virtualCores in interface YarnClientConfigurervirtualCores - The Yarn application virtual core resource countYarnClientConfigurer for chainingpublic YarnClientConfigurer clientClass(java.lang.Class<? extends YarnClient> clazz)
YarnClientConfigurerYarnClient class.
public void configure(YarnClientConfigure client) throws Exception {
client
.clientClass(MyYarnClient.class);
}
clientClass in interface YarnClientConfigurerclazz - The Yarn client classYarnClientConfigurer for chainingpublic YarnClientConfigurer clientClass(java.lang.String clazz)
YarnClientConfigurerYarnClient as a fully qualified class name.
public void configure(YarnClientConfigure client) throws Exception {
client
.clientClass("com.example.MyYarnClient");
}
clientClass in interface YarnClientConfigurerclazz - The Yarn client classYarnClientConfigurer for chainingpublic void configuration(org.apache.hadoop.conf.Configuration configuration)
public void setCommands(java.lang.String... commands)
public void setResourceLocalizer(ResourceLocalizer resourceLocalizer)
public void setEnvironment(java.util.Map<java.lang.String,java.lang.String> environment)