Search in sources :

Example 21 with Private

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

the class AbstractYarnScheduler method completedContainer.

@VisibleForTesting
@Private
public // clean up a completed container
void completedContainer(RMContainer rmContainer, ContainerStatus containerStatus, RMContainerEventType event) {
    if (rmContainer == null) {
        LOG.info("Container " + containerStatus.getContainerId() + " completed with event " + event + ", but corresponding RMContainer doesn't exist.");
        return;
    }
    if (rmContainer.getExecutionType() == ExecutionType.GUARANTEED) {
        completedContainerInternal(rmContainer, containerStatus, event);
        completeOustandingUpdatesWhichAreReserved(rmContainer, containerStatus, event);
    } else {
        ContainerId containerId = rmContainer.getContainerId();
        // Inform the container
        rmContainer.handle(new RMContainerFinishedEvent(containerId, containerStatus, event));
        SchedulerApplicationAttempt schedulerAttempt = getCurrentAttemptForContainer(containerId);
        if (schedulerAttempt != null) {
            schedulerAttempt.removeRMContainer(containerId);
        }
        if (LOG.isDebugEnabled()) {
            LOG.debug("Completed container: " + rmContainer.getContainerId() + " in state: " + rmContainer.getState() + " event:" + event);
        }
        getSchedulerNode(rmContainer.getNodeId()).releaseContainer(rmContainer.getContainerId(), false);
    }
    // If the container is getting killed in ACQUIRED state, the requester (AM
    // for regular containers and RM itself for AM container) will not know what
    // happened. Simply add the ResourceRequest back again so that requester
    // doesn't need to do anything conditionally.
    recoverResourceRequestForContainer(rmContainer);
}
Also used : ContainerId(org.apache.hadoop.yarn.api.records.ContainerId) RMContainerFinishedEvent(org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainerFinishedEvent) VisibleForTesting(com.google.common.annotations.VisibleForTesting) Private(org.apache.hadoop.classification.InterfaceAudience.Private)

Example 22 with Private

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

the class ZKRMStateStore method constructZkRootNodeACL.

/**
   * Given the {@link Configuration} and {@link ACL}s used (sourceACLs) for
   * ZooKeeper access, construct the {@link ACL}s for the store's root node.
   * In the constructed {@link ACL}, all the users allowed by sourceACLs are
   * given read-write-admin access, while the current RM has exclusive
   * create-delete access.
   *
   * To be called only when HA is enabled and the configuration doesn't set an
   * ACL for the root node.
   * @param conf the configuration
   * @param sourceACLs the source ACLs
   * @return ACLs for the store's root node
   * @throws java.security.NoSuchAlgorithmException thrown if the digest
   * algorithm used by Zookeeper cannot be found
   */
@VisibleForTesting
@Private
@Unstable
protected List<ACL> constructZkRootNodeACL(Configuration conf, List<ACL> sourceACLs) throws NoSuchAlgorithmException {
    List<ACL> zkRootNodeAclList = new ArrayList<>();
    for (ACL acl : sourceACLs) {
        zkRootNodeAclList.add(new ACL(ZKUtil.removeSpecificPerms(acl.getPerms(), CREATE_DELETE_PERMS), acl.getId()));
    }
    zkRootNodeUsername = HAUtil.getConfValueForRMInstance(YarnConfiguration.RM_ADDRESS, YarnConfiguration.DEFAULT_RM_ADDRESS, conf);
    Id rmId = new Id(zkRootNodeAuthScheme, DigestAuthenticationProvider.generateDigest(zkRootNodeUsername + ":" + resourceManager.getZkRootNodePassword()));
    zkRootNodeAclList.add(new ACL(CREATE_DELETE_PERMS, rmId));
    return zkRootNodeAclList;
}
Also used : ArrayList(java.util.ArrayList) ACL(org.apache.zookeeper.data.ACL) ApplicationAttemptId(org.apache.hadoop.yarn.api.records.ApplicationAttemptId) ApplicationId(org.apache.hadoop.yarn.api.records.ApplicationId) ReservationId(org.apache.hadoop.yarn.api.records.ReservationId) Id(org.apache.zookeeper.data.Id) VisibleForTesting(com.google.common.annotations.VisibleForTesting) Private(org.apache.hadoop.classification.InterfaceAudience.Private) Unstable(org.apache.hadoop.classification.InterfaceStability.Unstable)

Example 23 with Private

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

the class RMAppAttemptImpl method getAMRMTokenKeyId.

@Private
public int getAMRMTokenKeyId() {
    Integer keyId = this.amrmTokenKeyId;
    if (keyId == null) {
        this.readLock.lock();
        try {
            if (this.amrmToken == null) {
                throw new YarnRuntimeException("Missing AMRM token for " + this.applicationAttemptId);
            }
            keyId = this.amrmToken.decodeIdentifier().getKeyId();
            this.amrmTokenKeyId = keyId;
        } catch (IOException e) {
            throw new YarnRuntimeException("AMRM token decode error for " + this.applicationAttemptId, e);
        } finally {
            this.readLock.unlock();
        }
    }
    return keyId;
}
Also used : YarnRuntimeException(org.apache.hadoop.yarn.exceptions.YarnRuntimeException) IOException(java.io.IOException) Private(org.apache.hadoop.classification.InterfaceAudience.Private)

Example 24 with Private

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

the class SCMStore method createAppCheckerService.

/**
   * Create an instance of the AppChecker service via reflection based on the
   * {@link YarnConfiguration#SCM_APP_CHECKER_CLASS} parameter.
   * 
   * @param conf
   * @return an instance of the AppChecker class
   */
@Private
@SuppressWarnings("unchecked")
public static AppChecker createAppCheckerService(Configuration conf) {
    Class<? extends AppChecker> defaultCheckerClass;
    try {
        defaultCheckerClass = (Class<? extends AppChecker>) Class.forName(YarnConfiguration.DEFAULT_SCM_APP_CHECKER_CLASS);
    } catch (Exception e) {
        throw new YarnRuntimeException("Invalid default scm app checker class" + YarnConfiguration.DEFAULT_SCM_APP_CHECKER_CLASS, e);
    }
    AppChecker checker = ReflectionUtils.newInstance(conf.getClass(YarnConfiguration.SCM_APP_CHECKER_CLASS, defaultCheckerClass, AppChecker.class), conf);
    return checker;
}
Also used : YarnRuntimeException(org.apache.hadoop.yarn.exceptions.YarnRuntimeException) AppChecker(org.apache.hadoop.yarn.server.sharedcachemanager.AppChecker) YarnRuntimeException(org.apache.hadoop.yarn.exceptions.YarnRuntimeException) YarnException(org.apache.hadoop.yarn.exceptions.YarnException) Private(org.apache.hadoop.classification.InterfaceAudience.Private)

Example 25 with Private

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

the class RemoteAppChecker method getActiveApplications.

@Override
@Private
public Collection<ApplicationId> getActiveApplications() throws YarnException {
    try {
        List<ApplicationId> activeApps = new ArrayList<ApplicationId>();
        List<ApplicationReport> apps = client.getApplications(ACTIVE_STATES);
        for (ApplicationReport app : apps) {
            activeApps.add(app.getApplicationId());
        }
        return activeApps;
    } catch (IOException e) {
        throw new YarnException(e);
    }
}
Also used : ApplicationReport(org.apache.hadoop.yarn.api.records.ApplicationReport) ArrayList(java.util.ArrayList) IOException(java.io.IOException) ApplicationId(org.apache.hadoop.yarn.api.records.ApplicationId) YarnException(org.apache.hadoop.yarn.exceptions.YarnException) 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