@InterfaceAudience.Public @InterfaceStability.Stable public abstract class Container extends Object implements Comparable<Container>
Container represents an allocated resource in the cluster.
The ResourceManager is the sole authority to allocate any
Container to applications. The allocated Container
is always on a single node and has a unique ContainerId. It has
a specific amount of Resource allocated.
It includes details such as:
ContainerId for the container, which is globally unique.NodeId of the node on which it is allocated.
Resource allocated to the container.Priority at which the container was allocated.Token of the container, used to securely verify
authenticity of the allocation.
ApplicationMaster receives the Container
from the ResourceManager during resource-negotiation and then
talks to the NodeManager to start/stop containers.ApplicationMasterProtocol.allocate(org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest),
ContainerManagementProtocol.startContainers(org.apache.hadoop.yarn.api.protocolrecords.StartContainersRequest),
ContainerManagementProtocol.stopContainers(org.apache.hadoop.yarn.api.protocolrecords.StopContainersRequest)| Constructor and Description |
|---|
Container() |
| Modifier and Type | Method and Description |
|---|---|
long |
getAllocationRequestId()
Get the optional ID corresponding to the original
ResourceRequest{@link #getAllocationRequestId()}s which is satisfied by
this allocated Container. |
abstract Token |
getContainerToken()
Get the
ContainerToken for the container. |
abstract ExecutionType |
getExecutionType()
Get the
ExecutionType for the container. |
abstract ContainerId |
getId()
Get the globally unique identifier for the container.
|
abstract String |
getNodeHttpAddress()
Get the http uri of the node on which the container is allocated.
|
abstract NodeId |
getNodeId()
Get the identifier of the node on which the container is allocated.
|
abstract Priority |
getPriority()
Get the
Priority at which the Container was
allocated. |
abstract Resource |
getResource()
Get the
Resource allocated to the container. |
int |
getVersion()
Get the version of this container.
|
static Container |
newInstance(ContainerId containerId,
NodeId nodeId,
String nodeHttpAddress,
Resource resource,
Priority priority,
Token containerToken) |
static Container |
newInstance(ContainerId containerId,
NodeId nodeId,
String nodeHttpAddress,
Resource resource,
Priority priority,
Token containerToken,
ExecutionType executionType) |
void |
setAllocationRequestId(long allocationRequestID)
Set the optional ID corresponding to the original
ResourceRequest{@link #setAllocationRequestId(long)}
etAllocationRequestId()}s which is satisfied by this allocated Container. |
abstract void |
setContainerToken(Token containerToken) |
abstract void |
setExecutionType(ExecutionType executionType)
Set the
ExecutionType for the container. |
abstract void |
setId(ContainerId id) |
abstract void |
setNodeHttpAddress(String nodeHttpAddress) |
abstract void |
setNodeId(NodeId nodeId) |
abstract void |
setPriority(Priority priority) |
abstract void |
setResource(Resource resource) |
void |
setVersion(int version)
Set the version of this container.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcompareTo@InterfaceAudience.Private @InterfaceStability.Unstable public static Container newInstance(ContainerId containerId, NodeId nodeId, String nodeHttpAddress, Resource resource, Priority priority, Token containerToken)
@InterfaceAudience.Private @InterfaceStability.Unstable public static Container newInstance(ContainerId containerId, NodeId nodeId, String nodeHttpAddress, Resource resource, Priority priority, Token containerToken, ExecutionType executionType)
@InterfaceAudience.Public @InterfaceStability.Stable public abstract ContainerId getId()
@InterfaceAudience.Private @InterfaceStability.Unstable public abstract void setId(ContainerId id)
@InterfaceAudience.Public @InterfaceStability.Stable public abstract NodeId getNodeId()
@InterfaceAudience.Private @InterfaceStability.Unstable public abstract void setNodeId(NodeId nodeId)
@InterfaceAudience.Public @InterfaceStability.Stable public abstract String getNodeHttpAddress()
@InterfaceAudience.Private @InterfaceStability.Unstable public abstract void setNodeHttpAddress(String nodeHttpAddress)
@InterfaceAudience.Public @InterfaceStability.Stable public abstract Resource getResource()
Resource allocated to the container.Resource allocated to the container@InterfaceAudience.Private @InterfaceStability.Unstable public abstract void setResource(Resource resource)
@InterfaceAudience.Public @InterfaceStability.Stable public abstract Priority getPriority()
Priority at which the Container was
allocated.Priority at which the Container was
allocated@InterfaceAudience.Private @InterfaceStability.Unstable public abstract void setPriority(Priority priority)
@InterfaceAudience.Public @InterfaceStability.Stable public abstract Token getContainerToken()
ContainerToken for the container.
ContainerToken is the security token used by the framework
to verify authenticity of any Container.
The ResourceManager, on container allocation provides a
secure token which is verified by the NodeManager on
container launch.
Applications do not need to care about ContainerToken, they
are transparently handled by the framework - the allocated
Container includes the ContainerToken.
ContainerToken for the containerApplicationMasterProtocol.allocate(org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest),
ContainerManagementProtocol.startContainers(org.apache.hadoop.yarn.api.protocolrecords.StartContainersRequest)@InterfaceAudience.Private @InterfaceStability.Unstable public abstract void setContainerToken(Token containerToken)
@InterfaceAudience.Private @InterfaceStability.Unstable public abstract ExecutionType getExecutionType()
ExecutionType for the container.ExecutionType for the container.@InterfaceAudience.Private @InterfaceStability.Unstable public abstract void setExecutionType(ExecutionType executionType)
ExecutionType for the container.executionType - ExecutionType@InterfaceAudience.Public @InterfaceStability.Evolving public long getAllocationRequestId()
ResourceRequest{@link #getAllocationRequestId()}s which is satisfied by
this allocated Container.
The scheduler may return multiple AllocateResponses corresponding
to the same ID as and when scheduler allocates Containers.
Applications can continue to completely ignore the returned ID in
the response and use the allocation for any of their outstanding requests.
@InterfaceAudience.Private @InterfaceStability.Unstable public void setAllocationRequestId(long allocationRequestID)
ResourceRequest{@link #setAllocationRequestId(long)}
etAllocationRequestId()}s which is satisfied by this allocated Container.
The scheduler may return multiple AllocateResponses corresponding
to the same ID as and when scheduler allocates Containers.
Applications can continue to completely ignore the returned ID in
the response and use the allocation for any of their outstanding requests.
If the ID is not set, scheduler will continue to work as previously and all
allocated Container(s) will have the default ID, -1.
allocationRequestID - the ID corresponding to the original
allocation request which is satisfied by this
allocation.@InterfaceAudience.Private @InterfaceStability.Unstable public int getVersion()
@InterfaceAudience.Private @InterfaceStability.Unstable public void setVersion(int version)
version - of this container.Copyright © 2022 Apache Software Foundation. All rights reserved.