Exemple #1
0
 /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.InvalidResourceRequestException
 ///     "/>
 private ResourceRequest ValidateAndCreateResourceRequest(ApplicationSubmissionContext
                                                          submissionContext, bool isRecovery)
 {
     // Validation of the ApplicationSubmissionContext needs to be completed
     // here. Only those fields that are dependent on RM's configuration are
     // checked here as they have to be validated whether they are part of new
     // submission or just being recovered.
     // Check whether AM resource requirements are within required limits
     if (!submissionContext.GetUnmanagedAM())
     {
         ResourceRequest amReq = submissionContext.GetAMContainerResourceRequest();
         if (amReq == null)
         {
             amReq = BuilderUtils.NewResourceRequest(RMAppAttemptImpl.AmContainerPriority, ResourceRequest
                                                     .Any, submissionContext.GetResource(), 1);
         }
         // set label expression for AM container
         if (null == amReq.GetNodeLabelExpression())
         {
             amReq.SetNodeLabelExpression(submissionContext.GetNodeLabelExpression());
         }
         try
         {
             SchedulerUtils.NormalizeAndValidateRequest(amReq, scheduler.GetMaximumResourceCapability
                                                            (), submissionContext.GetQueue(), scheduler, isRecovery, rmContext);
         }
         catch (InvalidResourceRequestException e)
         {
             Log.Warn("RM app submission failed in validating AM resource request" + " for application "
                      + submissionContext.GetApplicationId(), e);
             throw;
         }
         SchedulerUtils.NormalizeRequest(amReq, scheduler.GetResourceCalculator(), scheduler
                                         .GetClusterResource(), scheduler.GetMinimumResourceCapability(), scheduler.GetMaximumResourceCapability
                                             (), scheduler.GetMinimumResourceCapability());
         return(amReq);
     }
     return(null);
 }