Search in sources :

Example 21 with RMAppEvent

use of org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppEvent in project hadoop by apache.

the class RMAppManager method submitApplication.

@SuppressWarnings("unchecked")
protected void submitApplication(ApplicationSubmissionContext submissionContext, long submitTime, String user) throws YarnException {
    ApplicationId applicationId = submissionContext.getApplicationId();
    // Passing start time as -1. It will be eventually set in RMAppImpl
    // constructor.
    RMAppImpl application = createAndPopulateNewRMApp(submissionContext, submitTime, user, false, -1);
    try {
        if (UserGroupInformation.isSecurityEnabled()) {
            this.rmContext.getDelegationTokenRenewer().addApplicationAsync(applicationId, BuilderUtils.parseCredentials(submissionContext), submissionContext.getCancelTokensWhenComplete(), application.getUser(), BuilderUtils.parseTokensConf(submissionContext));
        } else {
            // Dispatcher is not yet started at this time, so these START events
            // enqueued should be guaranteed to be first processed when dispatcher
            // gets started.
            this.rmContext.getDispatcher().getEventHandler().handle(new RMAppEvent(applicationId, RMAppEventType.START));
        }
    } catch (Exception e) {
        LOG.warn("Unable to parse credentials for " + applicationId, e);
        // Sending APP_REJECTED is fine, since we assume that the
        // RMApp is in NEW state and thus we haven't yet informed the
        // scheduler about the existence of the application
        this.rmContext.getDispatcher().getEventHandler().handle(new RMAppEvent(applicationId, RMAppEventType.APP_REJECTED, e.getMessage()));
        throw RPCUtil.getRemoteException(e);
    }
}
Also used : RMAppImpl(org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppImpl) RMAppEvent(org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppEvent) ApplicationId(org.apache.hadoop.yarn.api.records.ApplicationId) InvalidResourceRequestException(org.apache.hadoop.yarn.exceptions.InvalidResourceRequestException) YarnException(org.apache.hadoop.yarn.exceptions.YarnException) InvalidLabelResourceRequestException(org.apache.hadoop.yarn.exceptions.InvalidLabelResourceRequestException) AccessControlException(org.apache.hadoop.security.AccessControlException)

Aggregations

RMAppEvent (org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppEvent)21 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)8 Test (org.junit.Test)7 RMApp (org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp)6 YarnConfiguration (org.apache.hadoop.yarn.conf.YarnConfiguration)5 RMAppImpl (org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppImpl)5 Event (org.apache.hadoop.yarn.event.Event)4 SchedulerApplication (org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApplication)4 Configuration (org.apache.hadoop.conf.Configuration)3 AccessControlException (org.apache.hadoop.security.AccessControlException)3 ApplicationSubmissionContext (org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext)3 YarnException (org.apache.hadoop.yarn.exceptions.YarnException)3 VisibleForTesting (com.google.common.annotations.VisibleForTesting)2 IOException (java.io.IOException)2 Credentials (org.apache.hadoop.security.Credentials)2 SubmitApplicationRequest (org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationRequest)2 ApplicationAttemptId (org.apache.hadoop.yarn.api.records.ApplicationAttemptId)2 ContainerLaunchContext (org.apache.hadoop.yarn.api.records.ContainerLaunchContext)2 NodeId (org.apache.hadoop.yarn.api.records.NodeId)2 EventHandler (org.apache.hadoop.yarn.event.EventHandler)2