Search in sources :

Example 11 with NMTokenSecretManagerInNM

use of org.apache.hadoop.yarn.server.nodemanager.security.NMTokenSecretManagerInNM in project hadoop by apache.

the class TestResourceLocalizationService method createSpyService.

private ResourceLocalizationService createSpyService(DrainDispatcher dispatcher, LocalDirsHandlerService dirsHandler, NMStateStoreService stateStore) {
    ContainerExecutor exec = mock(ContainerExecutor.class);
    LocalizerTracker mockLocalizerTracker = mock(LocalizerTracker.class);
    DeletionService delService = mock(DeletionService.class);
    NMContext nmContext = new NMContext(new NMContainerTokenSecretManager(conf), new NMTokenSecretManagerInNM(), null, new ApplicationACLsManager(conf), stateStore, false, conf);
    ResourceLocalizationService rawService = new ResourceLocalizationService(dispatcher, exec, delService, dirsHandler, nmContext);
    ResourceLocalizationService spyService = spy(rawService);
    doReturn(mockServer).when(spyService).createServer();
    doReturn(mockLocalizerTracker).when(spyService).createLocalizerTracker(isA(Configuration.class));
    doReturn(lfs).when(spyService).getLocalFileContext(isA(Configuration.class));
    return spyService;
}
Also used : ContainerExecutor(org.apache.hadoop.yarn.server.nodemanager.ContainerExecutor) DefaultContainerExecutor(org.apache.hadoop.yarn.server.nodemanager.DefaultContainerExecutor) ApplicationACLsManager(org.apache.hadoop.yarn.server.security.ApplicationACLsManager) NMContext(org.apache.hadoop.yarn.server.nodemanager.NodeManager.NMContext) Configuration(org.apache.hadoop.conf.Configuration) YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) LocalizerTracker(org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.ResourceLocalizationService.LocalizerTracker) NMContainerTokenSecretManager(org.apache.hadoop.yarn.server.nodemanager.security.NMContainerTokenSecretManager) DeletionService(org.apache.hadoop.yarn.server.nodemanager.DeletionService) NMTokenSecretManagerInNM(org.apache.hadoop.yarn.server.nodemanager.security.NMTokenSecretManagerInNM)

Example 12 with NMTokenSecretManagerInNM

use of org.apache.hadoop.yarn.server.nodemanager.security.NMTokenSecretManagerInNM in project hadoop by apache.

the class TestLocalCacheDirectoryManager method testMinimumPerDirectoryFileLimit.

@Test
public void testMinimumPerDirectoryFileLimit() {
    YarnConfiguration conf = new YarnConfiguration();
    conf.set(YarnConfiguration.NM_LOCAL_CACHE_MAX_FILES_PER_DIRECTORY, "1");
    Exception e = null;
    NMContext nmContext = new NMContext(new NMContainerTokenSecretManager(conf), new NMTokenSecretManagerInNM(), null, new ApplicationACLsManager(conf), new NMNullStateStoreService(), false, conf);
    ResourceLocalizationService service = new ResourceLocalizationService(null, null, null, null, nmContext);
    try {
        service.init(conf);
    } catch (Exception e1) {
        e = e1;
    }
    Assert.assertNotNull(e);
    Assert.assertEquals(YarnRuntimeException.class, e.getClass());
    Assert.assertEquals(e.getMessage(), YarnConfiguration.NM_LOCAL_CACHE_MAX_FILES_PER_DIRECTORY + " parameter is configured with a value less than 37.");
}
Also used : ApplicationACLsManager(org.apache.hadoop.yarn.server.security.ApplicationACLsManager) NMContext(org.apache.hadoop.yarn.server.nodemanager.NodeManager.NMContext) YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) NMContainerTokenSecretManager(org.apache.hadoop.yarn.server.nodemanager.security.NMContainerTokenSecretManager) NMTokenSecretManagerInNM(org.apache.hadoop.yarn.server.nodemanager.security.NMTokenSecretManagerInNM) NMNullStateStoreService(org.apache.hadoop.yarn.server.nodemanager.recovery.NMNullStateStoreService) YarnRuntimeException(org.apache.hadoop.yarn.exceptions.YarnRuntimeException) Test(org.junit.Test)

Example 13 with NMTokenSecretManagerInNM

use of org.apache.hadoop.yarn.server.nodemanager.security.NMTokenSecretManagerInNM in project hadoop by apache.

the class TestNMAppsPage method testNMAppsPage.

@Test
public void testNMAppsPage() {
    Configuration conf = new Configuration();
    final NMContext nmcontext = new NMContext(new NMContainerTokenSecretManager(conf), new NMTokenSecretManagerInNM(), null, new ApplicationACLsManager(conf), new NMNullStateStoreService(), false, conf);
    Injector injector = WebAppTests.createMockInjector(NMContext.class, nmcontext, new Module() {

        @Override
        public void configure(Binder binder) {
            NodeManager nm = TestNMAppsPage.mocknm(nmcontext);
            binder.bind(NodeManager.class).toInstance(nm);
            binder.bind(Context.class).toInstance(nmcontext);
        }
    });
    ApplicationBlock instance = injector.getInstance(ApplicationBlock.class);
    instance.set(YarnWebParams.APPLICATION_ID, applicationid);
    instance.render();
}
Also used : Binder(com.google.inject.Binder) NodeManager(org.apache.hadoop.yarn.server.nodemanager.NodeManager) ApplicationACLsManager(org.apache.hadoop.yarn.server.security.ApplicationACLsManager) Configuration(org.apache.hadoop.conf.Configuration) NMContext(org.apache.hadoop.yarn.server.nodemanager.NodeManager.NMContext) Injector(com.google.inject.Injector) NMContainerTokenSecretManager(org.apache.hadoop.yarn.server.nodemanager.security.NMContainerTokenSecretManager) NMTokenSecretManagerInNM(org.apache.hadoop.yarn.server.nodemanager.security.NMTokenSecretManagerInNM) Module(com.google.inject.Module) NMNullStateStoreService(org.apache.hadoop.yarn.server.nodemanager.recovery.NMNullStateStoreService) ApplicationBlock(org.apache.hadoop.yarn.server.nodemanager.webapp.ApplicationPage.ApplicationBlock) Test(org.junit.Test)

Aggregations

NMTokenSecretManagerInNM (org.apache.hadoop.yarn.server.nodemanager.security.NMTokenSecretManagerInNM)13 NMContainerTokenSecretManager (org.apache.hadoop.yarn.server.nodemanager.security.NMContainerTokenSecretManager)9 NMContext (org.apache.hadoop.yarn.server.nodemanager.NodeManager.NMContext)7 YarnConfiguration (org.apache.hadoop.yarn.conf.YarnConfiguration)6 ApplicationACLsManager (org.apache.hadoop.yarn.server.security.ApplicationACLsManager)6 Configuration (org.apache.hadoop.conf.Configuration)5 Test (org.junit.Test)5 ApplicationAttemptId (org.apache.hadoop.yarn.api.records.ApplicationAttemptId)4 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)4 ContainerId (org.apache.hadoop.yarn.api.records.ContainerId)4 YarnRPC (org.apache.hadoop.yarn.ipc.YarnRPC)4 InvalidToken (org.apache.hadoop.security.token.SecretManager.InvalidToken)3 NodeId (org.apache.hadoop.yarn.api.records.NodeId)3 Resource (org.apache.hadoop.yarn.api.records.Resource)3 Token (org.apache.hadoop.yarn.api.records.Token)3 MasterKey (org.apache.hadoop.yarn.server.api.records.MasterKey)3 NodeManager (org.apache.hadoop.yarn.server.nodemanager.NodeManager)3 NMNullStateStoreService (org.apache.hadoop.yarn.server.nodemanager.recovery.NMNullStateStoreService)3 FileContext (org.apache.hadoop.fs.FileContext)2 Path (org.apache.hadoop.fs.Path)2