Search in sources :

Example 1 with InvalidAuxServiceException

use of org.apache.hadoop.yarn.exceptions.InvalidAuxServiceException in project hadoop by apache.

the class ContainerManagerImpl method performContainerPreStartChecks.

private void performContainerPreStartChecks(NMTokenIdentifier nmTokenIdentifier, StartContainerRequest request, ContainerTokenIdentifier containerTokenIdentifier) throws YarnException, InvalidToken {
    /*
   * 1) It should save the NMToken into NMTokenSecretManager. This is done
   * here instead of RPC layer because at the time of opening/authenticating
   * the connection it doesn't know what all RPC calls user will make on it.
   * Also new NMToken is issued only at startContainer (once it gets
   * renewed).
   *
   * 2) It should validate containerToken. Need to check below things. a) It
   * is signed by correct master key (part of retrieve password). b) It
   * belongs to correct Node Manager (part of retrieve password). c) It has
   * correct RMIdentifier. d) It is not expired.
   */
    authorizeStartAndResourceIncreaseRequest(nmTokenIdentifier, containerTokenIdentifier, true);
    // update NMToken
    updateNMTokenIdentifier(nmTokenIdentifier);
    ContainerLaunchContext launchContext = request.getContainerLaunchContext();
    Map<String, ByteBuffer> serviceData = getAuxServiceMetaData();
    if (launchContext.getServiceData() != null && !launchContext.getServiceData().isEmpty()) {
        for (Entry<String, ByteBuffer> meta : launchContext.getServiceData().entrySet()) {
            if (null == serviceData.get(meta.getKey())) {
                throw new InvalidAuxServiceException("The auxService:" + meta.getKey() + " does not exist");
            }
        }
    }
}
Also used : ContainerLaunchContext(org.apache.hadoop.yarn.api.records.ContainerLaunchContext) ByteString(com.google.protobuf.ByteString) ByteBuffer(java.nio.ByteBuffer) InvalidAuxServiceException(org.apache.hadoop.yarn.exceptions.InvalidAuxServiceException)

Aggregations

ByteString (com.google.protobuf.ByteString)1 ByteBuffer (java.nio.ByteBuffer)1 ContainerLaunchContext (org.apache.hadoop.yarn.api.records.ContainerLaunchContext)1 InvalidAuxServiceException (org.apache.hadoop.yarn.exceptions.InvalidAuxServiceException)1