public class DefaultMasterContainerAllocatorConfigurer extends AnnotationConfigurerAdapter<YarnAppmaster,YarnAppmasterConfigurer,YarnAppmasterBuilder> implements MasterContainerAllocatorConfigurer
AnnotationConfigurer
for YarnAppmaster
container allocator.Modifier and Type | Class and Description |
---|---|
class |
DefaultMasterContainerAllocatorConfigurer.DefaultMasterContainerAllocatorCollectionConfigurer |
MasterContainerAllocatorConfigurer.MasterContainerAllocatorCollectionConfigurer
Constructor and Description |
---|
DefaultMasterContainerAllocatorConfigurer() |
Modifier and Type | Method and Description |
---|---|
void |
configure(YarnAppmasterBuilder builder)
Configure the
AnnotationBuilder by setting the necessary properties
on the AnnotationBuilder . |
MasterContainerAllocatorConfigurer |
locality(boolean locality)
Specify a locality relaxing for
ContainerAllocator . |
MasterContainerAllocatorConfigurer |
memory(int memory)
Specify a container memory for
ContainerAllocator . |
MasterContainerAllocatorConfigurer |
memory(java.lang.String memory)
Specify a container memory for
ContainerAllocator . |
MasterContainerAllocatorConfigurer |
priority(java.lang.Integer priority)
Specify a container priority for
ContainerAllocator . |
MasterContainerAllocatorConfigurer |
virtualCores(java.lang.Integer virtualCores)
Specify a container virtual cores for
ContainerAllocator . |
MasterContainerAllocatorConfigurer.MasterContainerAllocatorCollectionConfigurer |
withCollection(java.lang.String id)
Specify a collection of container allocator attributes.
|
addObjectPostProcessor, and, getBuilder, init, isAssignable, setBuilder
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
and
public DefaultMasterContainerAllocatorConfigurer()
public void configure(YarnAppmasterBuilder builder) throws java.lang.Exception
AnnotationConfigurer
AnnotationBuilder
by setting the necessary properties
on the AnnotationBuilder
.configure
in interface AnnotationConfigurer<YarnAppmaster,YarnAppmasterBuilder>
configure
in class AnnotationConfigurerAdapter<YarnAppmaster,YarnAppmasterConfigurer,YarnAppmasterBuilder>
builder
- the builderjava.lang.Exception
- if error occurredpublic MasterContainerAllocatorConfigurer priority(java.lang.Integer priority)
MasterContainerAllocatorConfigurer
ContainerAllocator
.
public void configure(YarnAppmasterConfigure master) throws Exception { master .withContainerAllocator() .priority(0); }
<yarn:master> <yarn:container-allocator priority="0"/> </yarn:master>
priority
in interface MasterContainerAllocatorConfigurer
priority
- the priorityMasterContainerAllocatorConfigurer
for chainingpublic MasterContainerAllocatorConfigurer virtualCores(java.lang.Integer virtualCores)
MasterContainerAllocatorConfigurer
ContainerAllocator
.
public void configure(YarnAppmasterConfigure master) throws Exception { master .withContainerAllocator() .virtualCores(1); }
<yarn:master> <yarn:container-allocator virtualcores="1"/> </yarn:master>
virtualCores
in interface MasterContainerAllocatorConfigurer
virtualCores
- the virtual coresMasterContainerAllocatorConfigurer
for chainingpublic MasterContainerAllocatorConfigurer memory(java.lang.String memory)
MasterContainerAllocatorConfigurer
ContainerAllocator
.
The 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 MB
s and thus becomes a zero. Also too
high values may make resource allocation to behave badly.
JavaConfig:
public void configure(YarnAppmasterConfigure master) throws Exception { master .withContainerAllocator() .memory("1G"); }
<yarn:master> <yarn:container-allocator memory="1024"/> </yarn:master>
memory
in interface MasterContainerAllocatorConfigurer
memory
- the memoryMasterContainerAllocatorConfigurer
for chainingpublic MasterContainerAllocatorConfigurer memory(int memory)
MasterContainerAllocatorConfigurer
ContainerAllocator
.
public void configure(YarnAppmasterConfigure master) throws Exception { master .withContainerAllocator() .memory(1024); }
<yarn:master> <yarn:container-allocator memory="1024"/> </yarn:master>
memory
in interface MasterContainerAllocatorConfigurer
memory
- the memoryMasterContainerAllocatorConfigurer
for chainingMasterContainerAllocatorConfigurer.memory(String)
public MasterContainerAllocatorConfigurer locality(boolean locality)
MasterContainerAllocatorConfigurer
ContainerAllocator
. Setting
this flag true
means that resource requests will
not use locality relaxing. Default for this flag is false
.
public void configure(YarnAppmasterConfigure master) throws Exception { master .withContainerAllocator() .locality(false); }
<yarn:master> <yarn:container-allocator locality="false"/> </yarn:master>
locality
in interface MasterContainerAllocatorConfigurer
locality
- the locality flag for resource relaxingMasterContainerAllocatorConfigurer
for chainingpublic MasterContainerAllocatorConfigurer.MasterContainerAllocatorCollectionConfigurer withCollection(java.lang.String id)
MasterContainerAllocatorConfigurer
DefaultMasterContainerAllocatorConfigurer.DefaultMasterContainerAllocatorCollectionConfigurer
into a current configurer.
public void configure(YarnAppmasterConfigure master) throws Exception { master .withContainerAllocator() .withCollection("id") .priority(0); }
withCollection
in interface MasterContainerAllocatorConfigurer
id
- the idMasterContainerAllocatorConfigurer.MasterContainerAllocatorCollectionConfigurer
for chaining