Search in sources :

Example 1 with NodesListManager

use of org.apache.hadoop.yarn.server.resourcemanager.NodesListManager in project hadoop by apache.

the class TestRMNMRPCResponseId method setUp.

@Before
public void setUp() {
    Configuration conf = new Configuration();
    // Dispatcher that processes events inline
    Dispatcher dispatcher = new InlineDispatcher();
    dispatcher.register(SchedulerEventType.class, new EventHandler<Event>() {

        @Override
        public void handle(Event event) {
            // ignore
            ;
        }
    });
    RMContext context = new RMContextImpl(dispatcher, null, null, null, null, null, new RMContainerTokenSecretManager(conf), new NMTokenSecretManagerInRM(conf), null, null);
    dispatcher.register(RMNodeEventType.class, new ResourceManager.NodeEventDispatcher(context));
    NodesListManager nodesListManager = new NodesListManager(context);
    nodesListManager.init(conf);
    context.getContainerTokenSecretManager().rollMasterKey();
    context.getNMTokenSecretManager().rollMasterKey();
    resourceTrackerService = new ResourceTrackerService(context, nodesListManager, new NMLivelinessMonitor(dispatcher), context.getContainerTokenSecretManager(), context.getNMTokenSecretManager());
    resourceTrackerService.init(conf);
}
Also used : RMContext(org.apache.hadoop.yarn.server.resourcemanager.RMContext) Configuration(org.apache.hadoop.conf.Configuration) InlineDispatcher(org.apache.hadoop.yarn.event.InlineDispatcher) ResourceTrackerService(org.apache.hadoop.yarn.server.resourcemanager.ResourceTrackerService) ResourceManager(org.apache.hadoop.yarn.server.resourcemanager.ResourceManager) Dispatcher(org.apache.hadoop.yarn.event.Dispatcher) InlineDispatcher(org.apache.hadoop.yarn.event.InlineDispatcher) NMTokenSecretManagerInRM(org.apache.hadoop.yarn.server.resourcemanager.security.NMTokenSecretManagerInRM) Event(org.apache.hadoop.yarn.event.Event) RMContainerTokenSecretManager(org.apache.hadoop.yarn.server.resourcemanager.security.RMContainerTokenSecretManager) NMLivelinessMonitor(org.apache.hadoop.yarn.server.resourcemanager.NMLivelinessMonitor) NodesListManager(org.apache.hadoop.yarn.server.resourcemanager.NodesListManager) RMContextImpl(org.apache.hadoop.yarn.server.resourcemanager.RMContextImpl) Before(org.junit.Before)

Example 2 with NodesListManager

use of org.apache.hadoop.yarn.server.resourcemanager.NodesListManager in project hadoop by apache.

the class TestNodesListManager method testCachedResolverWithEvent.

@Test
public void testCachedResolverWithEvent() throws Exception {
    Logger rootLogger = LogManager.getRootLogger();
    rootLogger.setLevel(Level.DEBUG);
    YarnConfiguration conf = new YarnConfiguration();
    conf.setInt(YarnConfiguration.RM_NODE_IP_CACHE_EXPIRY_INTERVAL_SECS, 30);
    MockRM rm = new MockRM(conf);
    rm.init(conf);
    NodesListManager nodesListManager = rm.getNodesListManager();
    nodesListManager.init(conf);
    nodesListManager.start();
    NodesListManager.CachedResolver resolver = (NodesListManager.CachedResolver) nodesListManager.getResolver();
    resolver.addToCache("testCachedResolverHost1", "1.1.1.1");
    resolver.addToCache("testCachedResolverHost2", "1.1.1.2");
    Assert.assertEquals("1.1.1.1", resolver.resolve("testCachedResolverHost1"));
    Assert.assertEquals("1.1.1.2", resolver.resolve("testCachedResolverHost2"));
    RMNode rmnode1 = MockNodes.newNodeInfo(1, Resource.newInstance(28000, 8), 1, "testCachedResolverHost1", 1234);
    RMNode rmnode2 = MockNodes.newNodeInfo(1, Resource.newInstance(28000, 8), 1, "testCachedResolverHost2", 1234);
    nodesListManager.handle(new NodesListManagerEvent(NodesListManagerEventType.NODE_USABLE, rmnode1));
    Assert.assertNotEquals("1.1.1.1", resolver.resolve("testCachedResolverHost1"));
    Assert.assertEquals("1.1.1.2", resolver.resolve("testCachedResolverHost2"));
    nodesListManager.handle(new NodesListManagerEvent(NodesListManagerEventType.NODE_USABLE, rmnode2));
    Assert.assertNotEquals("1.1.1.1", resolver.resolve("testCachedResolverHost1"));
    Assert.assertNotEquals("1.1.1.2", resolver.resolve("testCachedResolverHost2"));
}
Also used : NodesListManagerEvent(org.apache.hadoop.yarn.server.resourcemanager.NodesListManagerEvent) RMNode(org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode) YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) MockRM(org.apache.hadoop.yarn.server.resourcemanager.MockRM) Logger(org.apache.log4j.Logger) NodesListManager(org.apache.hadoop.yarn.server.resourcemanager.NodesListManager) Test(org.junit.Test)

Example 3 with NodesListManager

use of org.apache.hadoop.yarn.server.resourcemanager.NodesListManager in project hadoop by apache.

the class TestNodesListManager method testDefaultResolver.

@Test
public void testDefaultResolver() throws Exception {
    Logger rootLogger = LogManager.getRootLogger();
    rootLogger.setLevel(Level.DEBUG);
    YarnConfiguration conf = new YarnConfiguration();
    MockRM rm = new MockRM(conf);
    rm.init(conf);
    NodesListManager nodesListManager = rm.getNodesListManager();
    NodesListManager.Resolver resolver = nodesListManager.getResolver();
    Assert.assertTrue("default resolver should be DirectResolver", resolver instanceof NodesListManager.DirectResolver);
}
Also used : YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) MockRM(org.apache.hadoop.yarn.server.resourcemanager.MockRM) Logger(org.apache.log4j.Logger) NodesListManager(org.apache.hadoop.yarn.server.resourcemanager.NodesListManager) Test(org.junit.Test)

Example 4 with NodesListManager

use of org.apache.hadoop.yarn.server.resourcemanager.NodesListManager in project hadoop by apache.

the class TestNMExpiry method setUp.

@Before
public void setUp() {
    Configuration conf = new Configuration();
    // Dispatcher that processes events inline
    Dispatcher dispatcher = new InlineDispatcher();
    RMContext context = new RMContextImpl(dispatcher, null, null, null, null, null, null, null, null, null);
    dispatcher.register(SchedulerEventType.class, new InlineDispatcher.EmptyEventHandler());
    dispatcher.register(RMNodeEventType.class, new NodeEventDispatcher(context));
    NMLivelinessMonitor nmLivelinessMonitor = new TestNmLivelinessMonitor(dispatcher);
    nmLivelinessMonitor.init(conf);
    nmLivelinessMonitor.start();
    NodesListManager nodesListManager = new NodesListManager(context);
    nodesListManager.init(conf);
    RMContainerTokenSecretManager containerTokenSecretManager = new RMContainerTokenSecretManager(conf);
    containerTokenSecretManager.start();
    NMTokenSecretManagerInRM nmTokenSecretManager = new NMTokenSecretManagerInRM(conf);
    nmTokenSecretManager.start();
    resourceTrackerService = new ResourceTrackerService(context, nodesListManager, nmLivelinessMonitor, containerTokenSecretManager, nmTokenSecretManager);
    resourceTrackerService.init(conf);
    resourceTrackerService.start();
}
Also used : RMContext(org.apache.hadoop.yarn.server.resourcemanager.RMContext) YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) Configuration(org.apache.hadoop.conf.Configuration) InlineDispatcher(org.apache.hadoop.yarn.event.InlineDispatcher) ResourceTrackerService(org.apache.hadoop.yarn.server.resourcemanager.ResourceTrackerService) NodeEventDispatcher(org.apache.hadoop.yarn.server.resourcemanager.ResourceManager.NodeEventDispatcher) Dispatcher(org.apache.hadoop.yarn.event.Dispatcher) InlineDispatcher(org.apache.hadoop.yarn.event.InlineDispatcher) NMTokenSecretManagerInRM(org.apache.hadoop.yarn.server.resourcemanager.security.NMTokenSecretManagerInRM) NodeEventDispatcher(org.apache.hadoop.yarn.server.resourcemanager.ResourceManager.NodeEventDispatcher) NMLivelinessMonitor(org.apache.hadoop.yarn.server.resourcemanager.NMLivelinessMonitor) RMContainerTokenSecretManager(org.apache.hadoop.yarn.server.resourcemanager.security.RMContainerTokenSecretManager) NodesListManager(org.apache.hadoop.yarn.server.resourcemanager.NodesListManager) RMContextImpl(org.apache.hadoop.yarn.server.resourcemanager.RMContextImpl) Before(org.junit.Before)

Example 5 with NodesListManager

use of org.apache.hadoop.yarn.server.resourcemanager.NodesListManager in project hadoop by apache.

the class TestNMReconnect method setUp.

@Before
public void setUp() {
    Configuration conf = new Configuration();
    // Dispatcher that processes events inline
    dispatcher = new InlineDispatcher();
    dispatcher.register(RMNodeEventType.class, new TestRMNodeEventDispatcher());
    context = new RMContextImpl(dispatcher, null, null, null, null, null, null, null, null, null);
    dispatcher.register(SchedulerEventType.class, new InlineDispatcher.EmptyEventHandler());
    dispatcher.register(RMNodeEventType.class, new NodeEventDispatcher(context));
    NMLivelinessMonitor nmLivelinessMonitor = new NMLivelinessMonitor(dispatcher);
    nmLivelinessMonitor.init(conf);
    nmLivelinessMonitor.start();
    NodesListManager nodesListManager = new NodesListManager(context);
    nodesListManager.init(conf);
    RMContainerTokenSecretManager containerTokenSecretManager = new RMContainerTokenSecretManager(conf);
    containerTokenSecretManager.start();
    NMTokenSecretManagerInRM nmTokenSecretManager = new NMTokenSecretManagerInRM(conf);
    nmTokenSecretManager.start();
    resourceTrackerService = new ResourceTrackerService(context, nodesListManager, nmLivelinessMonitor, containerTokenSecretManager, nmTokenSecretManager);
    resourceTrackerService.init(conf);
    resourceTrackerService.start();
}
Also used : YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) Configuration(org.apache.hadoop.conf.Configuration) InlineDispatcher(org.apache.hadoop.yarn.event.InlineDispatcher) ResourceTrackerService(org.apache.hadoop.yarn.server.resourcemanager.ResourceTrackerService) NodeEventDispatcher(org.apache.hadoop.yarn.server.resourcemanager.ResourceManager.NodeEventDispatcher) NMLivelinessMonitor(org.apache.hadoop.yarn.server.resourcemanager.NMLivelinessMonitor) RMContainerTokenSecretManager(org.apache.hadoop.yarn.server.resourcemanager.security.RMContainerTokenSecretManager) NodesListManager(org.apache.hadoop.yarn.server.resourcemanager.NodesListManager) NMTokenSecretManagerInRM(org.apache.hadoop.yarn.server.resourcemanager.security.NMTokenSecretManagerInRM) RMContextImpl(org.apache.hadoop.yarn.server.resourcemanager.RMContextImpl) Before(org.junit.Before)

Aggregations

NodesListManager (org.apache.hadoop.yarn.server.resourcemanager.NodesListManager)7 YarnConfiguration (org.apache.hadoop.yarn.conf.YarnConfiguration)6 Configuration (org.apache.hadoop.conf.Configuration)4 NMLivelinessMonitor (org.apache.hadoop.yarn.server.resourcemanager.NMLivelinessMonitor)4 RMContextImpl (org.apache.hadoop.yarn.server.resourcemanager.RMContextImpl)4 ResourceTrackerService (org.apache.hadoop.yarn.server.resourcemanager.ResourceTrackerService)4 NMTokenSecretManagerInRM (org.apache.hadoop.yarn.server.resourcemanager.security.NMTokenSecretManagerInRM)4 RMContainerTokenSecretManager (org.apache.hadoop.yarn.server.resourcemanager.security.RMContainerTokenSecretManager)4 Dispatcher (org.apache.hadoop.yarn.event.Dispatcher)3 InlineDispatcher (org.apache.hadoop.yarn.event.InlineDispatcher)3 MockRM (org.apache.hadoop.yarn.server.resourcemanager.MockRM)3 RMContext (org.apache.hadoop.yarn.server.resourcemanager.RMContext)3 Logger (org.apache.log4j.Logger)3 Before (org.junit.Before)3 Test (org.junit.Test)3 NodesListManagerEvent (org.apache.hadoop.yarn.server.resourcemanager.NodesListManagerEvent)2 ResourceManager (org.apache.hadoop.yarn.server.resourcemanager.ResourceManager)2 NodeEventDispatcher (org.apache.hadoop.yarn.server.resourcemanager.ResourceManager.NodeEventDispatcher)2 RMNode (org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode)2 Service (org.apache.hadoop.service.Service)1