Class ContainerTokenIdentifier

java.lang.Object
org.apache.hadoop.security.token.TokenIdentifier
org.apache.hadoop.yarn.security.ContainerTokenIdentifier
All Implemented Interfaces:
Writable

@Public @Evolving public class ContainerTokenIdentifier extends TokenIdentifier
TokenIdentifier for a container. Encodes ContainerId, Resource needed by the container and the target NMs host-address.
  • Field Details

    • KIND

      public static final Text KIND
  • Constructor Details

    • ContainerTokenIdentifier

      public ContainerTokenIdentifier(ContainerId containerID, String hostName, String appSubmitter, Resource r, long expiryTimeStamp, int masterKeyId, long rmIdentifier, Priority priority, long creationTime)
    • ContainerTokenIdentifier

      @Deprecated public ContainerTokenIdentifier(ContainerId containerID, String hostName, String appSubmitter, Resource r, long expiryTimeStamp, int masterKeyId, long rmIdentifier, Priority priority, long creationTime, LogAggregationContext logAggregationContext)
      Deprecated.
      Use one of the other constructors instead.
      Creates a instance.
      Parameters:
      appSubmitter - appSubmitter
      containerID - container ID
      creationTime - creation time
      expiryTimeStamp - expiry timestamp
      hostName - hostname
      logAggregationContext - log aggregation context
      masterKeyId - master key ID
      priority - priority
      r - resource needed by the container
      rmIdentifier - ResourceManager identifier
    • ContainerTokenIdentifier

      public ContainerTokenIdentifier(ContainerId containerID, String hostName, String appSubmitter, Resource r, long expiryTimeStamp, int masterKeyId, long rmIdentifier, Priority priority, long creationTime, LogAggregationContext logAggregationContext, String nodeLabelExpression)
    • ContainerTokenIdentifier

      public ContainerTokenIdentifier(ContainerId containerID, String hostName, String appSubmitter, Resource r, long expiryTimeStamp, int masterKeyId, long rmIdentifier, Priority priority, long creationTime, LogAggregationContext logAggregationContext, String nodeLabelExpression, org.apache.hadoop.yarn.server.api.ContainerType containerType)
    • ContainerTokenIdentifier

      public ContainerTokenIdentifier(ContainerId containerID, int containerVersion, String hostName, String appSubmitter, Resource r, long expiryTimeStamp, int masterKeyId, long rmIdentifier, Priority priority, long creationTime, LogAggregationContext logAggregationContext, String nodeLabelExpression, org.apache.hadoop.yarn.server.api.ContainerType containerType, ExecutionType executionType)
    • ContainerTokenIdentifier

      public ContainerTokenIdentifier(ContainerId containerID, int containerVersion, String hostName, String appSubmitter, Resource r, long expiryTimeStamp, int masterKeyId, long rmIdentifier, Priority priority, long creationTime, LogAggregationContext logAggregationContext, String nodeLabelExpression, org.apache.hadoop.yarn.server.api.ContainerType containerType, ExecutionType executionType, long allocationRequestId)
      Convenience Constructor for existing clients.
      Parameters:
      containerID - containerID
      containerVersion - containerVersion
      hostName - hostName
      appSubmitter - appSubmitter
      r - resource
      expiryTimeStamp - expiryTimeStamp
      masterKeyId - masterKeyId
      rmIdentifier - rmIdentifier
      priority - priority
      creationTime - creationTime
      logAggregationContext - logAggregationContext
      nodeLabelExpression - nodeLabelExpression
      containerType - containerType
      executionType - executionType
      allocationRequestId - allocationRequestId
    • ContainerTokenIdentifier

      public ContainerTokenIdentifier(ContainerId containerID, int containerVersion, String hostName, String appSubmitter, Resource r, long expiryTimeStamp, int masterKeyId, long rmIdentifier, Priority priority, long creationTime, LogAggregationContext logAggregationContext, String nodeLabelExpression, org.apache.hadoop.yarn.server.api.ContainerType containerType, ExecutionType executionType, long allocationRequestId, Set<String> allocationTags)
      Create a Container Token Identifier.
      Parameters:
      containerID - containerID
      containerVersion - containerVersion
      hostName - hostName
      appSubmitter - appSubmitter
      r - resource
      expiryTimeStamp - expiryTimeStamp
      masterKeyId - masterKeyId
      rmIdentifier - rmIdentifier
      priority - priority
      creationTime - creationTime
      logAggregationContext - logAggregationContext
      nodeLabelExpression - nodeLabelExpression
      containerType - containerType
      executionType - executionType
      allocationRequestId - allocationRequestId
      allocationTags - Set of allocation Tags.
    • ContainerTokenIdentifier

      public ContainerTokenIdentifier()
      Default constructor needed by RPC layer/SecretManager.
  • Method Details

    • getContainerID

      public ContainerId getContainerID()
    • getApplicationSubmitter

      public String getApplicationSubmitter()
    • getNmHostAddress

      public String getNmHostAddress()
    • getResource

      public Resource getResource()
    • getExpiryTimeStamp

      public long getExpiryTimeStamp()
    • getMasterKeyId

      public int getMasterKeyId()
    • getPriority

      public Priority getPriority()
    • getCreationTime

      public long getCreationTime()
    • getRMIdentifier

      public long getRMIdentifier()
      Get the RMIdentifier of RM in which containers are allocated.
      Returns:
      RMIdentifier
    • getContainerType

      public org.apache.hadoop.yarn.server.api.ContainerType getContainerType()
      Get the ContainerType of container to allocate.
      Returns:
      ContainerType
    • getExecutionType

      public ExecutionType getExecutionType()
      Get the ExecutionType of container to allocate
      Returns:
      ExecutionType
    • getProto

      public org.apache.hadoop.yarn.proto.YarnSecurityTokenProtos.ContainerTokenIdentifierProto getProto()
    • getLogAggregationContext

      public LogAggregationContext getLogAggregationContext()
    • getAllocationRequestId

      public long getAllocationRequestId()
    • write

      public void write(DataOutput out) throws IOException
      Description copied from interface: Writable
      Serialize the fields of this object to out.
      Parameters:
      out - DataOuput to serialize this object into.
      Throws:
      IOException - any other problem for write.
    • readFields

      public void readFields(DataInput in) throws IOException
      Description copied from interface: Writable
      Deserialize the fields of this object from in.

      For efficiency, implementations should attempt to re-use storage in the existing object where possible.

      Parameters:
      in - DataInput to deseriablize this object from.
      Throws:
      IOException - any other problem for readFields.
    • getKind

      public Text getKind()
      Description copied from class: TokenIdentifier
      Get the token kind
      Specified by:
      getKind in class TokenIdentifier
      Returns:
      the kind of the token
    • getUser

      public UserGroupInformation getUser()
      Description copied from class: TokenIdentifier
      Get the Ugi with the username encoded in the token identifier
      Specified by:
      getUser in class TokenIdentifier
      Returns:
      the username. null is returned if username in the identifier is empty or null.
    • getVersion

      public int getVersion()
      Get the Container version
      Returns:
      container version
    • getNodeLabelExpression

      public String getNodeLabelExpression()
      Get the node-label-expression in the original ResourceRequest.
      Returns:
      node label expression.
    • getAllcationTags

      public Set<String> getAllcationTags()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object