예제 #1
0
        /// <exception cref="System.Exception"/>
        private ApplicationId SubmitAppAndGetAppId(string submitter, string queueName, bool
                                                   setupACLs)
        {
            GetNewApplicationRequest  newAppRequest   = GetNewApplicationRequest.NewInstance();
            ApplicationClientProtocol submitterClient = GetRMClientForUser(submitter);
            ApplicationId             applicationId   = submitterClient.GetNewApplication(newAppRequest).GetApplicationId
                                                            ();
            Resource resource = BuilderUtils.NewResource(1024, 1);
            IDictionary <ApplicationAccessType, string> acls = CreateACLs(submitter, setupACLs
                                                                          );
            ContainerLaunchContext amContainerSpec = ContainerLaunchContext.NewInstance(null,
                                                                                        null, null, null, null, acls);
            ApplicationSubmissionContext appSubmissionContext = ApplicationSubmissionContext.
                                                                NewInstance(applicationId, "applicationName", queueName, null, amContainerSpec,
                                                                            false, true, 1, resource, "applicationType");

            appSubmissionContext.SetApplicationId(applicationId);
            appSubmissionContext.SetQueue(queueName);
            SubmitApplicationRequest submitRequest = SubmitApplicationRequest.NewInstance(appSubmissionContext
                                                                                          );

            submitterClient.SubmitApplication(submitRequest);
            resourceManager.WaitForState(applicationId, RMAppState.Accepted);
            return(applicationId);
        }
예제 #2
0
        protected internal virtual void CreateApplicationWithAMResource(ApplicationAttemptId
                                                                        attId, string queue, string user, Resource amResource)
        {
            RMContext rmContext = resourceManager.GetRMContext();
            RMApp     rmApp     = new RMAppImpl(attId.GetApplicationId(), rmContext, conf, null, null
                                                , null, ApplicationSubmissionContext.NewInstance(null, null, null, null, null, false
                                                                                                 , false, 0, amResource, null), null, null, 0, null, null, null);

            rmContext.GetRMApps()[attId.GetApplicationId()] = rmApp;
            AppAddedSchedulerEvent appAddedEvent = new AppAddedSchedulerEvent(attId.GetApplicationId
                                                                                  (), queue, user);

            scheduler.Handle(appAddedEvent);
            AppAttemptAddedSchedulerEvent attempAddedEvent = new AppAttemptAddedSchedulerEvent
                                                                 (attId, false);

            scheduler.Handle(attempAddedEvent);
        }