Ejemplo n.º 1
0
 protected internal virtual NodeManager.NMContext CreateNMContext(NMContainerTokenSecretManager
                                                                  containerTokenSecretManager, NMTokenSecretManagerInNM nmTokenSecretManager, NMStateStoreService
                                                                  stateStore)
 {
     return(new NodeManager.NMContext(containerTokenSecretManager, nmTokenSecretManager
                                      , dirsHandler, aclsManager, stateStore));
 }
Ejemplo n.º 2
0
        /// <exception cref="System.Exception"/>
        protected override void ServiceInit(Configuration conf)
        {
            conf.SetBoolean(Dispatcher.DispatcherExitOnErrorKey, true);
            rmWorkPreservingRestartEnabled = conf.GetBoolean(YarnConfiguration.RmWorkPreservingRecoveryEnabled
                                                             , YarnConfiguration.DefaultRmWorkPreservingRecoveryEnabled);
            InitAndStartRecoveryStore(conf);
            NMContainerTokenSecretManager containerTokenSecretManager = new NMContainerTokenSecretManager
                                                                            (conf, nmStore);
            NMTokenSecretManagerInNM nmTokenSecretManager = new NMTokenSecretManagerInNM(nmStore
                                                                                         );

            RecoverTokens(nmTokenSecretManager, containerTokenSecretManager);
            this.aclsManager = new ApplicationACLsManager(conf);
            ContainerExecutor exec = ReflectionUtils.NewInstance(conf.GetClass <ContainerExecutor
                                                                                >(YarnConfiguration.NmContainerExecutor, typeof(DefaultContainerExecutor)), conf
                                                                 );

            try
            {
                exec.Init();
            }
            catch (IOException e)
            {
                throw new YarnRuntimeException("Failed to initialize container executor", e);
            }
            DeletionService del = CreateDeletionService(exec);

            AddService(del);
            // NodeManager level dispatcher
            this.dispatcher   = new AsyncDispatcher();
            nodeHealthChecker = new NodeHealthCheckerService();
            AddService(nodeHealthChecker);
            dirsHandler  = nodeHealthChecker.GetDiskHandler();
            this.context = CreateNMContext(containerTokenSecretManager, nmTokenSecretManager,
                                           nmStore);
            nodeStatusUpdater = CreateNodeStatusUpdater(context, dispatcher, nodeHealthChecker
                                                        );
            NodeResourceMonitor nodeResourceMonitor = CreateNodeResourceMonitor();

            AddService(nodeResourceMonitor);
            containerManager = CreateContainerManager(context, exec, del, nodeStatusUpdater,
                                                      this.aclsManager, dirsHandler);
            AddService(containerManager);
            ((NodeManager.NMContext)context).SetContainerManager(containerManager);
            WebServer webServer = CreateWebServer(context, containerManager.GetContainersMonitor
                                                      (), this.aclsManager, dirsHandler);

            AddService(webServer);
            ((NodeManager.NMContext)context).SetWebServer(webServer);
            dispatcher.Register(typeof(ContainerManagerEventType), containerManager);
            dispatcher.Register(typeof(NodeManagerEventType), this);
            AddService(dispatcher);
            DefaultMetricsSystem.Initialize("NodeManager");
            // StatusUpdater should be added last so that it get started last
            // so that we make sure everything is up before registering with RM.
            AddService(nodeStatusUpdater);
            base.ServiceInit(conf);
        }
Ejemplo n.º 3
0
 /// <exception cref="System.IO.IOException"/>
 private void RecoverTokens(NMTokenSecretManagerInNM nmTokenSecretManager, NMContainerTokenSecretManager
                            containerTokenSecretManager)
 {
     if (nmStore.CanRecover())
     {
         nmTokenSecretManager.Recover();
         containerTokenSecretManager.Recover();
     }
 }
Ejemplo n.º 4
0
 public NMContext(NMContainerTokenSecretManager containerTokenSecretManager, NMTokenSecretManagerInNM
                  nmTokenSecretManager, LocalDirsHandlerService dirsHandler, ApplicationACLsManager
                  aclsManager, NMStateStoreService stateStore)
 {
     this.containerTokenSecretManager = containerTokenSecretManager;
     this.nmTokenSecretManager        = nmTokenSecretManager;
     this.dirsHandler = dirsHandler;
     this.aclsManager = aclsManager;
     this.nodeHealthStatus.SetIsNodeHealthy(true);
     this.nodeHealthStatus.SetHealthReport("Healthy");
     this.nodeHealthStatus.SetLastHealthReportTime(Runtime.CurrentTimeMillis());
     this.stateStore = stateStore;
 }
Ejemplo n.º 5
0
        /// <exception cref="System.IO.IOException"/>
        public static Token CreateContainerToken(ContainerId cId, long rmIdentifier, NodeId
                                                 nodeId, string user, NMContainerTokenSecretManager containerTokenSecretManager,
                                                 LogAggregationContext logAggregationContext)
        {
            Resource r = BuilderUtils.NewResource(1024, 1);
            ContainerTokenIdentifier containerTokenIdentifier = new ContainerTokenIdentifier(
                cId, nodeId.ToString(), user, r, Runtime.CurrentTimeMillis() + 100000L, 123, rmIdentifier
                , Priority.NewInstance(0), 0, logAggregationContext);
            Token containerToken = BuilderUtils.NewContainerToken(nodeId, containerTokenSecretManager
                                                                  .RetrievePassword(containerTokenIdentifier), containerTokenIdentifier);

            return(containerToken);
        }
Ejemplo n.º 6
0
 public _NMContext_108(NMContainerTokenSecretManager baseArg1, NMTokenSecretManagerInNM
                       baseArg2, LocalDirsHandlerService baseArg3, ApplicationACLsManager baseArg4, NMStateStoreService
                       baseArg5)
     : base(baseArg1, baseArg2, baseArg3, baseArg4, baseArg5)
 {
 }
Ejemplo n.º 7
0
 /// <exception cref="System.IO.IOException"/>
 public static Token CreateContainerToken(ContainerId cId, long rmIdentifier, NodeId
                                          nodeId, string user, NMContainerTokenSecretManager containerTokenSecretManager)
 {
     return(CreateContainerToken(cId, rmIdentifier, nodeId, user, containerTokenSecretManager
                                 , null));
 }