private int verifyContainerLog(int containerNum, List<String> expectedContent, boolean count, String expectedWord) { File logFolder = new File(yarnComponent.getYARNCluster().getNodeManager(0).getConfig() .get(YarnConfiguration.NM_LOG_DIRS, YarnConfiguration.DEFAULT_NM_LOG_DIRS));
NodeManager createNewNodeManager() { return new NodeManager(); }
private void createCRLFetcherService(Configuration conf) { if (conf.getBoolean(CommonConfigurationKeysPublic.IPC_SERVER_SSL_ENABLED, CommonConfigurationKeysPublic.IPC_SERVER_SSL_ENABLED_DEFAULT)) { if (conf.getBoolean(CommonConfigurationKeysPublic.HOPS_CRL_VALIDATION_ENABLED_KEY, CommonConfigurationKeysPublic.HOPS_CRL_VALIDATION_ENABLED_DEFAULT)) { LOG.info("Creating CertificateRevocationList Fetcher service"); revocationListFetcherService = new RevocationListFetcherService(); addService(revocationListFetcherService); } else { LOG.warn("RPC TLS is enabled but CRL validation is disabled"); } } }
initAndStartRecoveryStore(conf); } catch (IOException e) { String recoveryDirName = conf.get(YarnConfiguration.NM_RECOVERY_DIR); recoverTokens(nmTokenSecretManager, containerTokenSecretManager); this.context = createNMContext(containerTokenSecretManager, nmTokenSecretManager, nmStore, isDistSchedulingEnabled, conf); ResourcePluginManager pluginManager = createResourcePluginManager(); pluginManager.initialize(context); ((NMContext)context).setResourcePluginManager(pluginManager); ContainerExecutor exec = createContainerExecutor(conf); try { exec.init(context); DeletionService del = createDeletionService(exec); addService(del); this.dispatcher = createNMDispatcher(); getNodeHealthScriptRunner(conf), dirsHandler); addService(nodeHealthChecker); createNodeStatusUpdater(context, dispatcher, nodeHealthChecker); nodeLabelsProvider = createNodeLabelsProvider(conf); if (nodeLabelsProvider != null) {
initAndStartRecoveryStore(conf); createCRLFetcherService(conf); recoverTokens(nmTokenSecretManager, containerTokenSecretManager); DeletionService del = createDeletionService(exec); addService(del); nodeHealthChecker = new NodeHealthCheckerService( getNodeHealthScriptRunner(conf), dirsHandler); addService(nodeHealthChecker); this.context = createNMContext(containerTokenSecretManager, nmTokenSecretManager, nmStore); nodeLabelsProvider = createNodeLabelsProvider(conf); createNodeStatusUpdater(context, dispatcher, nodeHealthChecker); } else { addIfService(nodeLabelsProvider); nodeStatusUpdater = createNodeStatusUpdater(context, dispatcher, nodeHealthChecker, nodeLabelsProvider); nodeResourceMonitor = createNodeResourceMonitor(); addService(nodeResourceMonitor); ((NMContext) context).setNodeResourceMonitor(nodeResourceMonitor);
initAndStartRecoveryStore(conf); recoverTokens(nmTokenSecretManager, containerTokenSecretManager); DeletionService del = createDeletionService(exec); addService(del); addService(nodeHealthChecker); dirsHandler = nodeHealthChecker.getDiskHandler(); this.context = createNMContext(containerTokenSecretManager, nmTokenSecretManager, nmStore); createNodeStatusUpdater(context, dispatcher, nodeHealthChecker); NodeResourceMonitor nodeResourceMonitor = createNodeResourceMonitor(); addService(nodeResourceMonitor); createContainerManager(context, exec, del, nodeStatusUpdater, this.aclsManager, dirsHandler); addService(containerManager); ((NMContext) context).setContainerManager(containerManager); WebServer webServer = createWebServer(context, containerManager .getContainersMonitor(), this.aclsManager, dirsHandler); addService(webServer); ((NMContext) context).setWebServer(webServer); addService(dispatcher);
private void initAndStartNodeManager(Configuration conf, boolean hasToReboot) { try { // Remove the old hook if we are rebooting. if (hasToReboot && null != nodeManagerShutdownHook) { ShutdownHookManager.get().removeShutdownHook(nodeManagerShutdownHook); } nodeManagerShutdownHook = new CompositeServiceShutdownHook(this); ShutdownHookManager.get().addShutdownHook(nodeManagerShutdownHook, SHUTDOWN_HOOK_PRIORITY); // System exit should be called only when NodeManager is instantiated from // main() funtion this.shouldExitOnShutdownEvent = true; this.init(conf); this.start(); } catch (Throwable t) { LOG.fatal("Error starting NodeManager", t); System.exit(-1); } }
public static void main(String[] args) throws IOException { Thread.setDefaultUncaughtExceptionHandler(new YarnUncaughtExceptionHandler()); StringUtils.startupShutdownMessage(NodeManager.class, args, LOG); NodeManager nodeManager = new NodeManager(); Configuration conf = new YarnConfiguration(); new GenericOptionsParser(conf, args); nodeManager.initAndStartNodeManager(conf, false); }
@Override public void run() { try { NodeManager.this.stop(); } catch (Throwable t) { LOG.error("Error while shutting down NodeManager", t); } finally { if (shouldExitOnShutdownEvent && !ShutdownHookManager.get().isShutdownInProgress()) { ExitUtil.terminate(-1); } } } }.start();
+ nm.getConfig().get(dirsProperty)); dirsHandler = nm.getNodeHealthChecker().getDiskHandler(); List<String> list = localORLogDirs ? dirsHandler.getLocalDirs() : dirsHandler.getLogDirs();
protected synchronized void serviceStart() throws Exception { nodeManagers[index].start(); if (nodeManagers[index].getServiceState() != STATE.STARTED) { // NM could have failed. throw new IOException("NodeManager " + index + " failed to start"); } super.serviceStart(); }
nodeManagers[index].init(config); super.serviceInit(config);
initAndStartRecoveryStore(conf); recoverTokens(nmTokenSecretManager, containerTokenSecretManager); DeletionService del = createDeletionService(exec); addService(del); addService(nodeHealthChecker); dirsHandler = nodeHealthChecker.getDiskHandler(); this.context = createNMContext(containerTokenSecretManager, nmTokenSecretManager, nmStore); createNodeStatusUpdater(context, dispatcher, nodeHealthChecker); NodeResourceMonitor nodeResourceMonitor = createNodeResourceMonitor(); addService(nodeResourceMonitor); createContainerManager(context, exec, del, nodeStatusUpdater, this.aclsManager, dirsHandler); addService(containerManager); ((NMContext) context).setContainerManager(containerManager); WebServer webServer = createWebServer(context, containerManager .getContainersMonitor(), this.aclsManager, dirsHandler); addService(webServer); ((NMContext) context).setWebServer(webServer); addService(dispatcher);
private void initAndStartNodeManager(Configuration conf, boolean hasToReboot) { try { // Remove the old hook if we are rebooting. if (hasToReboot && null != nodeManagerShutdownHook) { ShutdownHookManager.get().removeShutdownHook(nodeManagerShutdownHook); } nodeManagerShutdownHook = new CompositeServiceShutdownHook(this); ShutdownHookManager.get().addShutdownHook(nodeManagerShutdownHook, SHUTDOWN_HOOK_PRIORITY); // System exit should be called only when NodeManager is instantiated from // main() funtion this.shouldExitOnShutdownEvent = true; this.init(conf); this.start(); } catch (Throwable t) { LOG.fatal("Error starting NodeManager", t); System.exit(-1); } }
public static void main(String[] args) throws IOException { Thread.setDefaultUncaughtExceptionHandler(new YarnUncaughtExceptionHandler()); StringUtils.startupShutdownMessage(NodeManager.class, args, LOG); @SuppressWarnings("resource") NodeManager nodeManager = new NodeManager(); Configuration conf = new YarnConfiguration(); new GenericOptionsParser(conf, args); nodeManager.initAndStartNodeManager(conf, false); }
@Override public void run() { try { NodeManager.this.stop(); } catch (Throwable t) { LOG.error("Error while shutting down NodeManager", t); } finally { if (shouldExitOnShutdownEvent && !ShutdownHookManager.get().isShutdownInProgress()) { ExitUtil.terminate(-1); } } } }.start();
+ nm.getConfig().get(dirsProperty)); dirsHandler = nm.getNodeHealthChecker().getDiskHandler(); List<String> list = localORLogDirs ? dirsHandler.getLocalDirs() : dirsHandler.getLogDirs();
protected synchronized void serviceStart() throws Exception { nodeManagers[index].start(); if (nodeManagers[index].getServiceState() != STATE.STARTED) { // NM could have failed. throw new IOException("NodeManager " + index + " failed to start"); } super.serviceStart(); }
nodeManagers[index].init(config); super.serviceInit(config);
protected NMContext createNMContext( NMContainerTokenSecretManager containerTokenSecretManager, NMTokenSecretManagerInNM nmTokenSecretManager, NMStateStoreService stateStore) { boolean isSSLEnabled = getConfig().getBoolean (CommonConfigurationKeysPublic.IPC_SERVER_SSL_ENABLED, CommonConfigurationKeysPublic.IPC_SERVER_SSL_ENABLED_DEFAULT); return new NMContext(containerTokenSecretManager, nmTokenSecretManager, dirsHandler, aclsManager, stateStore, isSSLEnabled); }