Exemplo n.º 1
0
        public virtual void TestNodeRegistrationVersionLessThanRM()
        {
            WriteToHostsFile("host2");
            Configuration conf = new Configuration();

            conf.Set(YarnConfiguration.RmNodesIncludeFilePath, hostFile.GetAbsolutePath());
            conf.Set(YarnConfiguration.RmNodemanagerMinimumVersion, "EqualToRM");
            rm = new MockRM(conf);
            rm.Start();
            string nmVersion = "1.9.9";
            ResourceTrackerService     resourceTrackerService = rm.GetResourceTrackerService();
            RegisterNodeManagerRequest req = Org.Apache.Hadoop.Yarn.Util.Records.NewRecord <RegisterNodeManagerRequest
                                                                                            >();
            NodeId   nodeId     = NodeId.NewInstance("host2", 1234);
            Resource capability = BuilderUtils.NewResource(1024, 1);

            req.SetResource(capability);
            req.SetNodeId(nodeId);
            req.SetHttpPort(1234);
            req.SetNMVersion(nmVersion);
            // trying to register a invalid node.
            RegisterNodeManagerResponse response = resourceTrackerService.RegisterNodeManager
                                                       (req);

            NUnit.Framework.Assert.AreEqual(NodeAction.Shutdown, response.GetNodeAction());
            NUnit.Framework.Assert.IsTrue("Diagnostic message did not contain: 'Disallowed NodeManager "
                                          + "Version " + nmVersion + ", is less than the minimum version'", response.GetDiagnosticsMessage
                                              ().Contains("Disallowed NodeManager Version " + nmVersion + ", is less than the minimum version "
                                                          ));
        }
Exemplo n.º 2
0
        /// <exception cref="System.IO.IOException"/>
        /// <exception cref="Org.Apache.Hadoop.Yarn.Exceptions.YarnException"/>
        public NodeManager(string hostName, int containerManagerPort, int httpPort, string
                           rackName, Resource capability, ResourceManager resourceManager)
        {
            this.containerManagerAddress = hostName + ":" + containerManagerPort;
            this.nodeHttpAddress         = hostName + ":" + httpPort;
            this.rackName = rackName;
            this.resourceTrackerService = resourceManager.GetResourceTrackerService();
            this.capability             = capability;
            Resources.AddTo(available, capability);
            this.nodeId = NodeId.NewInstance(hostName, containerManagerPort);
            RegisterNodeManagerRequest request = recordFactory.NewRecordInstance <RegisterNodeManagerRequest
                                                                                  >();

            request.SetHttpPort(httpPort);
            request.SetResource(capability);
            request.SetNodeId(this.nodeId);
            request.SetNMVersion(YarnVersionInfo.GetVersion());
            resourceTrackerService.RegisterNodeManager(request);
            this.resourceManager = resourceManager;
            resourceManager.GetResourceScheduler().GetNodeReport(this.nodeId);
        }
Exemplo n.º 3
0
        /// <exception cref="System.Exception"/>
        public virtual RegisterNodeManagerResponse RegisterNode(IList <NMContainerStatus>
                                                                containerReports, IList <ApplicationId> runningApplications)
        {
            RegisterNodeManagerRequest req = Org.Apache.Hadoop.Yarn.Util.Records.NewRecord <RegisterNodeManagerRequest
                                                                                            >();

            req.SetNodeId(nodeId);
            req.SetHttpPort(httpPort);
            Resource resource = BuilderUtils.NewResource(memory, vCores);

            req.SetResource(resource);
            req.SetContainerStatuses(containerReports);
            req.SetNMVersion(version);
            req.SetRunningApplications(runningApplications);
            RegisterNodeManagerResponse registrationResponse = resourceTracker.RegisterNodeManager
                                                                   (req);

            this.currentContainerTokenMasterKey = registrationResponse.GetContainerTokenMasterKey
                                                      ();
            this.currentNMTokenMasterKey = registrationResponse.GetNMTokenMasterKey();
            return(registrationResponse);
        }
Exemplo n.º 4
0
        public virtual void TestNodeRegistrationSuccess()
        {
            WriteToHostsFile("host2");
            Configuration conf = new Configuration();

            conf.Set(YarnConfiguration.RmNodesIncludeFilePath, hostFile.GetAbsolutePath());
            rm = new MockRM(conf);
            rm.Start();
            ResourceTrackerService     resourceTrackerService = rm.GetResourceTrackerService();
            RegisterNodeManagerRequest req = Org.Apache.Hadoop.Yarn.Util.Records.NewRecord <RegisterNodeManagerRequest
                                                                                            >();
            NodeId   nodeId     = NodeId.NewInstance("host2", 1234);
            Resource capability = BuilderUtils.NewResource(1024, 1);

            req.SetResource(capability);
            req.SetNodeId(nodeId);
            req.SetHttpPort(1234);
            req.SetNMVersion(YarnVersionInfo.GetVersion());
            // trying to register a invalid node.
            RegisterNodeManagerResponse response = resourceTrackerService.RegisterNodeManager
                                                       (req);

            NUnit.Framework.Assert.AreEqual(NodeAction.Normal, response.GetNodeAction());
        }