Search in sources :

Example 1 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 2 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)

Example 3 with Private

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

the class AMLauncher method setupTokens.

@Private
@VisibleForTesting
protected void setupTokens(ContainerLaunchContext container, ContainerId containerID) throws IOException {
    Map<String, String> environment = container.getEnvironment();
    environment.put(ApplicationConstants.APPLICATION_WEB_PROXY_BASE_ENV, application.getWebProxyBase());
    // Set AppSubmitTime to be consumable by the AM.
    ApplicationId applicationId = application.getAppAttemptId().getApplicationId();
    environment.put(ApplicationConstants.APP_SUBMIT_TIME_ENV, String.valueOf(rmContext.getRMApps().get(applicationId).getSubmitTime()));
    Credentials credentials = new Credentials();
    DataInputByteBuffer dibb = new DataInputByteBuffer();
    ByteBuffer tokens = container.getTokens();
    if (tokens != null) {
        // TODO: Don't do this kind of checks everywhere.
        dibb.reset(tokens);
        credentials.readTokenStorageStream(dibb);
        tokens.rewind();
    }
    // Add AMRMToken
    Token<AMRMTokenIdentifier> amrmToken = createAndSetAMRMToken();
    if (amrmToken != null) {
        credentials.addToken(amrmToken.getService(), amrmToken);
    }
    DataOutputBuffer dob = new DataOutputBuffer();
    credentials.writeTokenStorageToStream(dob);
    container.setTokens(ByteBuffer.wrap(dob.getData(), 0, dob.getLength()));
}
Also used : AMRMTokenIdentifier(org.apache.hadoop.yarn.security.AMRMTokenIdentifier) DataInputByteBuffer(org.apache.hadoop.io.DataInputByteBuffer) DataOutputBuffer(org.apache.hadoop.io.DataOutputBuffer) ApplicationId(org.apache.hadoop.yarn.api.records.ApplicationId) ByteBuffer(java.nio.ByteBuffer) DataInputByteBuffer(org.apache.hadoop.io.DataInputByteBuffer) Credentials(org.apache.hadoop.security.Credentials) VisibleForTesting(com.google.common.annotations.VisibleForTesting) Private(org.apache.hadoop.classification.InterfaceAudience.Private)

Example 4 with Private

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

the class DefaultWrapperServlet method doGet.

@Private
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    RequestDispatcher rd = getServletContext().getNamedDispatcher("default");
    HttpServletRequest wrapped = new HttpServletRequestWrapper(req) {

        public String getServletPath() {
            return "";
        }
    };
    rd.forward(wrapped, resp);
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) HttpServletRequestWrapper(javax.servlet.http.HttpServletRequestWrapper) RequestDispatcher(javax.servlet.RequestDispatcher) Private(org.apache.hadoop.classification.InterfaceAudience.Private)

Example 5 with Private

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

the class AMRMProxyApplicationContextImpl method getLocalAMRMTokenKeyId.

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

Aggregations

Private (org.apache.hadoop.classification.InterfaceAudience.Private)75 VisibleForTesting (com.google.common.annotations.VisibleForTesting)18 IOException (java.io.IOException)15 Path (org.apache.hadoop.fs.Path)13 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)12 ArrayList (java.util.ArrayList)9 FileStatus (org.apache.hadoop.fs.FileStatus)8 FileSystem (org.apache.hadoop.fs.FileSystem)6 Resource (org.apache.hadoop.yarn.api.records.Resource)6 DataInputStream (java.io.DataInputStream)5 EOFException (java.io.EOFException)5 PrintStream (java.io.PrintStream)5 Credentials (org.apache.hadoop.security.Credentials)5 LogReader (org.apache.hadoop.yarn.logaggregation.AggregatedLogFormat.LogReader)5 ApplicationAttemptId (org.apache.hadoop.yarn.api.records.ApplicationAttemptId)4 LocalResource (org.apache.hadoop.yarn.api.records.LocalResource)4 YarnRuntimeException (org.apache.hadoop.yarn.exceptions.YarnRuntimeException)4 ByteString (com.google.protobuf.ByteString)3 HashMap (java.util.HashMap)3 HashSet (java.util.HashSet)3