public interface YarnClientConfigurer
YarnClientConfigure is an interface for YarnClientBuilder which is
exposed to user via SpringYarnConfigurerAdapter.
Typically configuration is shown below.
@Configuration
@EnableYarn(enable=Enable.CLIENT)
static class Config extends SpringYarnConfigurerAdapter {
@Override
public void configure(YarnClientConfigure client) throws Exception {
client
.appName("myAppName")
.withMasterRunner()
.contextClass(MyAppmasterConfiguration.class);
}
}
<yarn:client app-name="myAppName"> <yarn:master-runner /> </yarn:client>
| 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. |
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.
|
YarnClientConfigurer |
priority(java.lang.Integer priority)
Specify a yarn application priority.
|
YarnClientConfigurer |
queue(java.lang.String queue)
Specify a yarn application submission queue.
|
YarnClientConfigurer |
virtualCores(java.lang.Integer virtualCores)
Specify a yarn application virtual core resource count.
|
ClientMasterRunnerConfigurer |
withMasterRunner()
Specify a runner for Appmaster.
|
ClientMasterRunnerConfigurer withMasterRunner() throws java.lang.Exception
DefaultClientMasterRunnerConfigurer
into current builder.
public void configure(YarnClientConfigure client) throws Exception {
client
.withMasterRunner()
.contextClass(MyAppmasterConfiguration.class);
}
<yarn:client> <yarn:master-runner /> </yarn:client>
ClientMasterRunnerConfigurer for chainingjava.lang.Exception - exceptionYarnClientConfigurer appName(java.lang.String appName)
public void configure(YarnClientConfigure client) throws Exception {
client
.appName("myAppName");
}
<yarn:client app-name="myAppName"/>
appName - The Yarn application nameYarnClientConfigurer for chainingYarnClientConfigurer appType(java.lang.String appType)
MAPREDUCE and other
applications defaults to YARN.
public void configure(YarnClientConfigure client) throws Exception {
client
.appType("BOOT");
}
appType - The Yarn application typeYarnClientConfigurer for chainingYarnClientConfigurer masterCommands(java.lang.String... commands)
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>
commands - The Yarn container commandsYarnAppmasterConfigurer for chainingYarnClientConfigurer priority(java.lang.Integer priority)
public void configure(YarnClientConfigure client) throws Exception {
client
.priority(0);
}
<yarn:client priority="0"/>
priority - The Yarn application priorityYarnClientConfigurer for chainingYarnClientConfigurer virtualCores(java.lang.Integer virtualCores)
public void configure(YarnClientConfigure client) throws Exception {
client
.virtualCores(1);
}
<yarn:client virtualcores="1"/>
virtualCores - The Yarn application virtual core resource countYarnClientConfigurer for chainingYarnClientConfigurer memory(java.lang.String memory)
memory 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 - The Yarn application containers memory reservationYarnClientConfigurer for chainingYarnClientConfigurer memory(int memory)
memory argument is given as MegaBytes.
public void configure(YarnClientConfigure client) throws Exception {
client
.memory(1024);
}
<yarn:client memory="1024"/>
memory - The Yarn application containers memory reservationYarnClientConfigurer for chainingmemory(String)YarnClientConfigurer queue(java.lang.String queue)
public void configure(YarnClientConfigure client) throws Exception {
client
.queue("default");
}
<yarn:client queue="default"/>
queue - The Yarn application submission queueYarnClientConfigurer for chainingYarnClientConfigurer clientClass(java.lang.Class<? extends YarnClient> clazz)
YarnClient class.
public void configure(YarnClientConfigure client) throws Exception {
client
.clientClass(MyYarnClient.class);
}
clazz - The Yarn client classYarnClientConfigurer for chainingYarnClientConfigurer clientClass(java.lang.String clazz)
YarnClient as a fully qualified class name.
public void configure(YarnClientConfigure client) throws Exception {
client
.clientClass("com.example.MyYarnClient");
}
clazz - The Yarn client classYarnClientConfigurer for chaining