Esempio n. 1
0
        public static void SetUpResourceManager()
        {
            Configuration.AddDefaultResource("config-with-security.xml");
            Configuration configuration = new YarnConfiguration();

            resourceManager = new _ResourceManager_74();
            resourceManager.Init(configuration);
            new _Thread_80().Start();
            int waitCount = 0;

            while (resourceManager.GetServiceState() == Service.STATE.Inited && waitCount++ <
                   10)
            {
                Log.Info("Waiting for RM to start...");
                Sharpen.Thread.Sleep(1000);
            }
            if (resourceManager.GetServiceState() != Service.STATE.Started)
            {
                throw new IOException("ResourceManager failed to start. Final state is " + resourceManager
                                      .GetServiceState());
            }
            Log.Info("ResourceManager RMAdmin address: " + configuration.Get(YarnConfiguration
                                                                             .RmAdminAddress));
            client = new ResourceManagerAdministrationProtocolPBClientImpl(1L, GetProtocolAddress
                                                                               (configuration), configuration);
        }
Esempio n. 2
0
        /// <exception cref="System.IO.IOException"/>
        /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
        private int RefreshServiceAcls()
        {
            // Refresh the service acls
            ResourceManagerAdministrationProtocol adminProtocol = CreateAdminProtocol();
            RefreshServiceAclsRequest             request       = recordFactory.NewRecordInstance <RefreshServiceAclsRequest
                                                                                                   >();

            adminProtocol.RefreshServiceAcls(request);
            return(0);
        }
Esempio n. 3
0
        /// <exception cref="System.IO.IOException"/>
        /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
        private int RefreshSuperUserGroupsConfiguration()
        {
            // Refresh the super-user groups
            ResourceManagerAdministrationProtocol      adminProtocol = CreateAdminProtocol();
            RefreshSuperUserGroupsConfigurationRequest request       = recordFactory.NewRecordInstance
                                                                       <RefreshSuperUserGroupsConfigurationRequest>();

            adminProtocol.RefreshSuperUserGroupsConfiguration(request);
            return(0);
        }
Esempio n. 4
0
        /// <exception cref="System.IO.IOException"/>
        /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
        private int RefreshUserToGroupsMappings()
        {
            // Refresh the user-to-groups mappings
            ResourceManagerAdministrationProtocol adminProtocol = CreateAdminProtocol();
            RefreshUserToGroupsMappingsRequest    request       = recordFactory.NewRecordInstance <RefreshUserToGroupsMappingsRequest
                                                                                                   >();

            adminProtocol.RefreshUserToGroupsMappings(request);
            return(0);
        }
Esempio n. 5
0
        /// <exception cref="System.IO.IOException"/>
        /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
        private int RefreshQueues()
        {
            // Refresh the queue properties
            ResourceManagerAdministrationProtocol adminProtocol = CreateAdminProtocol();
            RefreshQueuesRequest request = recordFactory.NewRecordInstance <RefreshQueuesRequest
                                                                            >();

            adminProtocol.RefreshQueues(request);
            return(0);
        }
Esempio n. 6
0
        /// <exception cref="System.IO.IOException"/>
        protected override GetUserMappingsProtocol GetUgmProtocol()
        {
            Configuration conf = GetConf();
            IPEndPoint    addr = conf.GetSocketAddr(YarnConfiguration.RmAdminAddress, YarnConfiguration
                                                    .DefaultRmAdminAddress, YarnConfiguration.DefaultRmAdminPort);
            YarnRPC rpc = YarnRPC.Create(conf);
            ResourceManagerAdministrationProtocol adminProtocol = (ResourceManagerAdministrationProtocol
                                                                   )rpc.GetProxy(typeof(ResourceManagerAdministrationProtocol), addr, GetConf());

            return(adminProtocol);
        }
Esempio n. 7
0
 /// <exception cref="System.IO.IOException"/>
 /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
 private int ReplaceLabelsOnNodes(IDictionary <NodeId, ICollection <string> > map)
 {
     if (directlyAccessNodeLabelStore)
     {
         GetNodeLabelManagerInstance(GetConf()).ReplaceLabelsOnNode(map);
     }
     else
     {
         ResourceManagerAdministrationProtocol adminProtocol = CreateAdminProtocol();
         ReplaceLabelsOnNodeRequest            request       = ReplaceLabelsOnNodeRequest.NewInstance(map);
         adminProtocol.ReplaceLabelsOnNode(request);
     }
     return(0);
 }
Esempio n. 8
0
        /// <exception cref="System.IO.IOException"/>
        /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
        private int RemoveFromClusterNodeLabels(string args)
        {
            ICollection <string> labels = BuildNodeLabelsSetFromStr(args);

            if (directlyAccessNodeLabelStore)
            {
                GetNodeLabelManagerInstance(GetConf()).RemoveFromClusterNodeLabels(labels);
            }
            else
            {
                ResourceManagerAdministrationProtocol adminProtocol = CreateAdminProtocol();
                RemoveFromClusterNodeLabelsRequest    request       = RemoveFromClusterNodeLabelsRequest.NewInstance
                                                                          (labels);
                adminProtocol.RemoveFromClusterNodeLabels(request);
            }
            return(0);
        }
Esempio n. 9
0
        public virtual void Configure()
        {
            remoteAdminServiceAccessed = false;
            admin = Org.Mockito.Mockito.Mock <ResourceManagerAdministrationProtocol>();
            Org.Mockito.Mockito.When(admin.AddToClusterNodeLabels(Matchers.Any <AddToClusterNodeLabelsRequest
                                                                                >())).ThenAnswer(new _Answer_79(this));
            haadmin = Org.Mockito.Mockito.Mock <HAServiceProtocol>();
            Org.Mockito.Mockito.When(haadmin.GetServiceStatus()).ThenReturn(new HAServiceStatus
                                                                                (HAServiceProtocol.HAServiceState.Initializing));
            HAServiceTarget haServiceTarget = Org.Mockito.Mockito.Mock <HAServiceTarget>();

            Org.Mockito.Mockito.When(haServiceTarget.GetProxy(Matchers.Any <Configuration>(),
                                                              Matchers.AnyInt())).ThenReturn(haadmin);
            rmAdminCLI = new _RMAdminCLI_96(this, haServiceTarget, new Configuration());
            InitDummyNodeLabelsManager();
            rmAdminCLI.localNodeLabelsManager = dummyNodeLabelsManager;
            YarnConfiguration conf = new YarnConfiguration();

            conf.SetBoolean(YarnConfiguration.RmHaEnabled, true);
            rmAdminCLIWithHAEnabled = new _RMAdminCLI_113(this, haServiceTarget, conf);
        }
Esempio n. 10
0
        /// <exception cref="System.IO.IOException"/>
        private int GetGroups(string[] usernames)
        {
            // Get groups users belongs to
            ResourceManagerAdministrationProtocol adminProtocol = CreateAdminProtocol();

            if (usernames.Length == 0)
            {
                usernames = new string[] { UserGroupInformation.GetCurrentUser().GetUserName() };
            }
            foreach (string username in usernames)
            {
                StringBuilder sb = new StringBuilder();
                sb.Append(username + " :");
                foreach (string group in adminProtocol.GetGroupsForUser(username))
                {
                    sb.Append(" ");
                    sb.Append(group);
                }
                System.Console.Out.WriteLine(sb);
            }
            return(0);
        }
 public ResourceManagerAdministrationProtocolPBServiceImpl(ResourceManagerAdministrationProtocol
                                                           impl)
 {
     this.real = impl;
 }