コード例 #1
0
        private int StartNMWebAppServer(string webAddr)
        {
            Context       nmContext    = new NodeManager.NMContext(null, null, null, null, null);
            ResourceView  resourceView = new _ResourceView_84();
            Configuration conf         = new Configuration();

            conf.Set(YarnConfiguration.NmLocalDirs, testRootDir.GetAbsolutePath());
            conf.Set(YarnConfiguration.NmLogDirs, testLogDir.GetAbsolutePath());
            NodeHealthCheckerService healthChecker = new NodeHealthCheckerService();

            healthChecker.Init(conf);
            LocalDirsHandlerService dirsHandler = healthChecker.GetDiskHandler();

            conf.Set(YarnConfiguration.NmWebappAddress, webAddr);
            WebServer server = new WebServer(nmContext, resourceView, new ApplicationACLsManager
                                                 (conf), dirsHandler);

            try
            {
                server.Init(conf);
                server.Start();
                return(server.GetPort());
            }
            finally
            {
                server.Stop();
                healthChecker.Stop();
            }
        }