Ejemplo n.º 1
0
        /// <exception cref="System.Exception"/>
        public virtual RegisterApplicationMasterResponse RegisterAppAttempt(bool wait)
        {
            if (wait)
            {
                WaitForState(RMAppAttemptState.Launched);
            }
            responseId = 0;
            RegisterApplicationMasterRequest req = Org.Apache.Hadoop.Yarn.Util.Records.NewRecord
                                                   <RegisterApplicationMasterRequest>();

            req.SetHost(string.Empty);
            req.SetRpcPort(1);
            req.SetTrackingUrl(string.Empty);
            if (ugi == null)
            {
                ugi = UserGroupInformation.CreateRemoteUser(attemptId.ToString());
                Org.Apache.Hadoop.Security.Token.Token <AMRMTokenIdentifier> token = context.GetRMApps
                                                                                         ()[attemptId.GetApplicationId()].GetRMAppAttempt(attemptId).GetAMRMToken();
                ugi.AddTokenIdentifier(token.DecodeIdentifier());
            }
            try
            {
                return(ugi.DoAs(new _PrivilegedExceptionAction_117(this, req)));
            }
            catch (UndeclaredThrowableException e)
            {
                throw (Exception)e.InnerException;
            }
        }
Ejemplo n.º 2
0
        protected internal virtual void Register()
        {
            //Register
            IPEndPoint serviceAddr = null;

            if (clientService != null)
            {
                serviceAddr = clientService.GetBindAddress();
            }
            try
            {
                RegisterApplicationMasterRequest request = recordFactory.NewRecordInstance <RegisterApplicationMasterRequest
                                                                                            >();
                if (serviceAddr != null)
                {
                    request.SetHost(serviceAddr.GetHostName());
                    request.SetRpcPort(serviceAddr.Port);
                    request.SetTrackingUrl(MRWebAppUtil.GetAMWebappScheme(GetConfig()) + serviceAddr.
                                           GetHostName() + ":" + clientService.GetHttpPort());
                }
                RegisterApplicationMasterResponse response = scheduler.RegisterApplicationMaster(
                    request);
                isApplicationMasterRegistered = true;
                maxContainerCapability        = response.GetMaximumResourceCapability();
                this.context.GetClusterInfo().SetMaxContainerCapability(maxContainerCapability);
                if (UserGroupInformation.IsSecurityEnabled())
                {
                    SetClientToAMToken(response.GetClientToAMTokenMasterKey());
                }
                this.applicationACLs = response.GetApplicationACLs();
                Log.Info("maxContainerCapability: " + maxContainerCapability);
                string queue = response.GetQueue();
                Log.Info("queue: " + queue);
                job.SetQueueName(queue);
                Sharpen.Collections.AddAll(this.schedulerResourceTypes, response.GetSchedulerResourceTypes
                                               ());
            }
            catch (Exception are)
            {
                Log.Error("Exception while registering", are);
                throw new YarnRuntimeException(are);
            }
        }