Search in sources :

Example 46 with Private

use of org.apache.hadoop.classification.InterfaceAudience.Private in project hadoop by apache.

the class AMRMProxyTokenSecretManager method createPassword.

@Override
@Private
protected byte[] createPassword(AMRMTokenIdentifier identifier) {
    this.readLock.lock();
    try {
        ApplicationAttemptId applicationAttemptId = identifier.getApplicationAttemptId();
        LOG.info("Creating password for " + applicationAttemptId);
        return createPassword(identifier.getBytes(), getMasterKey().getSecretKey());
    } finally {
        this.readLock.unlock();
    }
}
Also used : ApplicationAttemptId(org.apache.hadoop.yarn.api.records.ApplicationAttemptId) Private(org.apache.hadoop.classification.InterfaceAudience.Private)

Example 47 with Private

use of org.apache.hadoop.classification.InterfaceAudience.Private in project hadoop by apache.

the class NodeStatusUpdaterImpl method removeVeryOldStoppedContainersFromCache.

@Private
@VisibleForTesting
public void removeVeryOldStoppedContainersFromCache() {
    synchronized (recentlyStoppedContainers) {
        long currentTime = System.currentTimeMillis();
        Iterator<ContainerId> i = recentlyStoppedContainers.keySet().iterator();
        while (i.hasNext()) {
            ContainerId cid = i.next();
            if (recentlyStoppedContainers.get(cid) < currentTime) {
                if (!context.getContainers().containsKey(cid)) {
                    i.remove();
                    try {
                        context.getNMStateStore().removeContainer(cid);
                    } catch (IOException e) {
                        LOG.error("Unable to remove container " + cid + " in store", e);
                    }
                }
            } else {
                break;
            }
        }
    }
}
Also used : ContainerId(org.apache.hadoop.yarn.api.records.ContainerId) IOException(java.io.IOException) VisibleForTesting(com.google.common.annotations.VisibleForTesting) Private(org.apache.hadoop.classification.InterfaceAudience.Private)

Example 48 with Private

use of org.apache.hadoop.classification.InterfaceAudience.Private in project hadoop by apache.

the class NodeStatusUpdaterImpl method removeOrTrackCompletedContainersFromContext.

@VisibleForTesting
@Private
public void removeOrTrackCompletedContainersFromContext(List<ContainerId> containerIds) throws IOException {
    Set<ContainerId> removedContainers = new HashSet<ContainerId>();
    Set<ContainerId> removedNullContainers = new HashSet<ContainerId>();
    pendingContainersToRemove.addAll(containerIds);
    Iterator<ContainerId> iter = pendingContainersToRemove.iterator();
    while (iter.hasNext()) {
        ContainerId containerId = iter.next();
        // remove the container only if the container is at DONE state
        Container nmContainer = context.getContainers().get(containerId);
        if (nmContainer == null) {
            iter.remove();
            removedNullContainers.add(containerId);
        } else if (nmContainer.getContainerState().equals(org.apache.hadoop.yarn.server.nodemanager.containermanager.container.ContainerState.DONE)) {
            context.getContainers().remove(containerId);
            removedContainers.add(containerId);
            iter.remove();
        }
    }
    if (!removedContainers.isEmpty()) {
        LOG.info("Removed completed containers from NM context: " + removedContainers);
    }
    pendingCompletedContainers.clear();
}
Also used : Container(org.apache.hadoop.yarn.server.nodemanager.containermanager.container.Container) ContainerId(org.apache.hadoop.yarn.api.records.ContainerId) HashSet(java.util.HashSet) VisibleForTesting(com.google.common.annotations.VisibleForTesting) Private(org.apache.hadoop.classification.InterfaceAudience.Private)

Example 49 with Private

use of org.apache.hadoop.classification.InterfaceAudience.Private in project hadoop by apache.

the class ContainerManagerImpl method selectNMTokenIdentifier.

// Obtain the needed ContainerTokenIdentifier from the remote-UGI. RPC layer
// currently sets only the required id, but iterate through anyways just to
// be sure.
@Private
@VisibleForTesting
protected NMTokenIdentifier selectNMTokenIdentifier(UserGroupInformation remoteUgi) {
    Set<TokenIdentifier> tokenIdentifiers = remoteUgi.getTokenIdentifiers();
    NMTokenIdentifier resultId = null;
    for (TokenIdentifier id : tokenIdentifiers) {
        if (id instanceof NMTokenIdentifier) {
            resultId = (NMTokenIdentifier) id;
            break;
        }
    }
    return resultId;
}
Also used : NMTokenIdentifier(org.apache.hadoop.yarn.security.NMTokenIdentifier) TokenIdentifier(org.apache.hadoop.security.token.TokenIdentifier) ContainerTokenIdentifier(org.apache.hadoop.yarn.security.ContainerTokenIdentifier) NMTokenIdentifier(org.apache.hadoop.yarn.security.NMTokenIdentifier) VisibleForTesting(com.google.common.annotations.VisibleForTesting) Private(org.apache.hadoop.classification.InterfaceAudience.Private)

Example 50 with Private

use of org.apache.hadoop.classification.InterfaceAudience.Private in project hadoop by apache.

the class NMTokenSecretManagerInNM method setMasterKey.

/**
   * Used by NodeManagers to create a token-secret-manager with the key
   * obtained from the RM. This can happen during registration or when the RM
   * rolls the master-key and signal the NM.
   */
@Private
public synchronized void setMasterKey(MasterKey masterKey) {
    // Update keys only if the key has changed.
    if (super.currentMasterKey == null || super.currentMasterKey.getMasterKey().getKeyId() != masterKey.getKeyId()) {
        LOG.info("Rolling master-key for container-tokens, got key with id " + masterKey.getKeyId());
        if (super.currentMasterKey != null) {
            updatePreviousMasterKey(super.currentMasterKey);
        }
        updateCurrentMasterKey(new MasterKeyData(masterKey, createSecretKey(masterKey.getBytes().array())));
    }
}
Also used : MasterKeyData(org.apache.hadoop.yarn.server.security.MasterKeyData) Private(org.apache.hadoop.classification.InterfaceAudience.Private)

Aggregations

Private (org.apache.hadoop.classification.InterfaceAudience.Private)52 VisibleForTesting (com.google.common.annotations.VisibleForTesting)15 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)12 IOException (java.io.IOException)9 FileStatus (org.apache.hadoop.fs.FileStatus)8 ArrayList (java.util.ArrayList)6 Path (org.apache.hadoop.fs.Path)6 DataInputStream (java.io.DataInputStream)5 EOFException (java.io.EOFException)5 PrintStream (java.io.PrintStream)5 LogReader (org.apache.hadoop.yarn.logaggregation.AggregatedLogFormat.LogReader)5 ApplicationAttemptId (org.apache.hadoop.yarn.api.records.ApplicationAttemptId)4 ContainerId (org.apache.hadoop.yarn.api.records.ContainerId)4 Resource (org.apache.hadoop.yarn.api.records.Resource)4 YarnRuntimeException (org.apache.hadoop.yarn.exceptions.YarnRuntimeException)4 ByteString (com.google.protobuf.ByteString)2 FileNotFoundException (java.io.FileNotFoundException)2 AccessDeniedException (java.nio.file.AccessDeniedException)2 HashSet (java.util.HashSet)2 FileSystem (org.apache.hadoop.fs.FileSystem)2