Java Code Examples for org.apache.hadoop.yarn.server.nodemanager.NodeManager#getNodeHealthScriptRunner()

The following examples show how to use org.apache.hadoop.yarn.server.nodemanager.NodeManager#getNodeHealthScriptRunner() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseContainerManagerTest.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() throws IOException {
  localFS.delete(new Path(localDir.getAbsolutePath()), true);
  localFS.delete(new Path(tmpDir.getAbsolutePath()), true);
  localFS.delete(new Path(localLogDir.getAbsolutePath()), true);
  localFS.delete(new Path(remoteLogDir.getAbsolutePath()), true);
  localDir.mkdir();
  tmpDir.mkdir();
  localLogDir.mkdir();
  remoteLogDir.mkdir();
  LOG.info("Created localDir in " + localDir.getAbsolutePath());
  LOG.info("Created tmpDir in " + tmpDir.getAbsolutePath());

  String bindAddress = "0.0.0.0:12345";
  conf.set(YarnConfiguration.NM_ADDRESS, bindAddress);
  conf.set(YarnConfiguration.NM_LOCAL_DIRS, localDir.getAbsolutePath());
  conf.set(YarnConfiguration.NM_LOG_DIRS, localLogDir.getAbsolutePath());
  conf.set(YarnConfiguration.NM_REMOTE_APP_LOG_DIR, remoteLogDir.getAbsolutePath());

  conf.setLong(YarnConfiguration.NM_LOG_RETAIN_SECONDS, 1);
  // Default delSrvc
  delSrvc = createDeletionService();
  delSrvc.init(conf);

  exec = createContainerExecutor();
  dirsHandler = new LocalDirsHandlerService();
  nodeHealthChecker = new NodeHealthCheckerService(
      NodeManager.getNodeHealthScriptRunner(conf), dirsHandler);
  nodeHealthChecker.init(conf);
  containerManager = createContainerManager(delSrvc);
  ((NMContext)context).setContainerManager(containerManager);
  nodeStatusUpdater.init(conf);
  containerManager.init(conf);
  nodeStatusUpdater.start();
}
 
Example 2
Source File: TestContainerLogsPage.java    From hadoop with Apache License 2.0 4 votes vote down vote up
private NodeHealthCheckerService createNodeHealthCheckerService(Configuration conf) {
  NodeHealthScriptRunner scriptRunner = NodeManager.getNodeHealthScriptRunner(conf);
  LocalDirsHandlerService dirsHandler = new LocalDirsHandlerService();
  return new NodeHealthCheckerService(scriptRunner, dirsHandler);
}
 
Example 3
Source File: TestNMWebServicesApps.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@Override
protected void configureServlets() {
  conf.set(YarnConfiguration.NM_LOCAL_DIRS, testRootDir.getAbsolutePath());
  conf.set(YarnConfiguration.NM_LOG_DIRS, testLogDir.getAbsolutePath());
  LocalDirsHandlerService dirsHandler = new LocalDirsHandlerService();
  NodeHealthCheckerService healthChecker = new NodeHealthCheckerService(
      NodeManager.getNodeHealthScriptRunner(conf), dirsHandler);
  healthChecker.init(conf);
  dirsHandler = healthChecker.getDiskHandler();
  aclsManager = new ApplicationACLsManager(conf);
  nmContext = new NodeManager.NMContext(null, null, dirsHandler,
      aclsManager, null);
  NodeId nodeId = NodeId.newInstance("testhost.foo.com", 9999);
  ((NodeManager.NMContext)nmContext).setNodeId(nodeId);
  resourceView = new ResourceView() {
    @Override
    public long getVmemAllocatedForContainers() {
      // 15.5G in bytes
      return new Long("16642998272");
    }

    @Override
    public long getPmemAllocatedForContainers() {
      // 16G in bytes
      return new Long("17179869184");
    }

    @Override
    public long getVCoresAllocatedForContainers() {
      return new Long("4000");
    }

    @Override
    public long getGCoresAllocatedForContainers() {
      return new Long("4000");
    }

    @Override
    public boolean isVmemCheckEnabled() {
      return true;
    }

    @Override
    public boolean isPmemCheckEnabled() {
      return true;
    }
  };
  nmWebApp = new NMWebApp(resourceView, aclsManager, dirsHandler);
  bind(JAXBContextResolver.class);
  bind(NMWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(Context.class).toInstance(nmContext);
  bind(WebApp.class).toInstance(nmWebApp);
  bind(ResourceView.class).toInstance(resourceView);
  bind(ApplicationACLsManager.class).toInstance(aclsManager);
  bind(LocalDirsHandlerService.class).toInstance(dirsHandler);

  serve("/*").with(GuiceContainer.class);
}
 
Example 4
Source File: TestNMWebServices.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@Override
protected void configureServlets() {
  Configuration conf = new Configuration();
  conf.set(YarnConfiguration.NM_LOCAL_DIRS, testRootDir.getAbsolutePath());
  conf.set(YarnConfiguration.NM_LOG_DIRS, testLogDir.getAbsolutePath());
  dirsHandler = new LocalDirsHandlerService();
  NodeHealthCheckerService healthChecker = new NodeHealthCheckerService(
      NodeManager.getNodeHealthScriptRunner(conf), dirsHandler);
  healthChecker.init(conf);
  aclsManager = new ApplicationACLsManager(conf);
  nmContext = new NodeManager.NMContext(null, null, dirsHandler,
      aclsManager, null);
  NodeId nodeId = NodeId.newInstance("testhost.foo.com", 8042);
  ((NodeManager.NMContext)nmContext).setNodeId(nodeId);
  resourceView = new ResourceView() {
    @Override
    public long getVmemAllocatedForContainers() {
      // 15.5G in bytes
      return new Long("16642998272");
    }

    @Override
    public long getPmemAllocatedForContainers() {
      // 16G in bytes
      return new Long("17179869184");
    }
    @Override
    public long getVCoresAllocatedForContainers() {
      return new Long("4000");
    }
    @Override
    public long getGCoresAllocatedForContainers() {
      return new Long("4000");
    }
    @Override
    public boolean isVmemCheckEnabled() {
      return true;
    }
    @Override
    public boolean isPmemCheckEnabled() {
      return true;
    }
  };
  nmWebApp = new NMWebApp(resourceView, aclsManager, dirsHandler);
  bind(JAXBContextResolver.class);
  bind(NMWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(Context.class).toInstance(nmContext);
  bind(WebApp.class).toInstance(nmWebApp);
  bind(ResourceView.class).toInstance(resourceView);
  bind(ApplicationACLsManager.class).toInstance(aclsManager);
  bind(LocalDirsHandlerService.class).toInstance(dirsHandler);

  serve("/*").with(GuiceContainer.class);
}
 
Example 5
Source File: TestNMWebServer.java    From hadoop with Apache License 2.0 4 votes vote down vote up
private NodeHealthCheckerService createNodeHealthCheckerService(Configuration conf) {
  NodeHealthScriptRunner scriptRunner = NodeManager.getNodeHealthScriptRunner(conf);
  LocalDirsHandlerService dirsHandler = new LocalDirsHandlerService();
  return new NodeHealthCheckerService(scriptRunner, dirsHandler);
}
 
Example 6
Source File: TestNMWebServicesContainers.java    From hadoop with Apache License 2.0 4 votes vote down vote up
@Override
protected void configureServlets() {
  resourceView = new ResourceView() {
    @Override
    public long getVmemAllocatedForContainers() {
      // 15.5G in bytes
      return new Long("16642998272");
    }

    @Override
    public long getPmemAllocatedForContainers() {
      // 16G in bytes
      return new Long("17179869184");
    }

    @Override
    public long getVCoresAllocatedForContainers() {
      return new Long("4000");
    }

    @Override
    public long getGCoresAllocatedForContainers() {
      return new Long("4000");
    }

    @Override
    public boolean isVmemCheckEnabled() {
      return true;
    }

    @Override
    public boolean isPmemCheckEnabled() {
      return true;
    }
  };
  conf.set(YarnConfiguration.NM_LOCAL_DIRS, testRootDir.getAbsolutePath());
  conf.set(YarnConfiguration.NM_LOG_DIRS, testLogDir.getAbsolutePath());
  LocalDirsHandlerService dirsHandler = new LocalDirsHandlerService();
  NodeHealthCheckerService healthChecker = new NodeHealthCheckerService(
      NodeManager.getNodeHealthScriptRunner(conf), dirsHandler);
  healthChecker.init(conf);
  dirsHandler = healthChecker.getDiskHandler();
  aclsManager = new ApplicationACLsManager(conf);
  nmContext = new NodeManager.NMContext(null, null, dirsHandler,
      aclsManager, null) {
    public NodeId getNodeId() {
      return NodeId.newInstance("testhost.foo.com", 8042);
    };

    public int getHttpPort() {
      return 1234;
    };
  };
  nmWebApp = new NMWebApp(resourceView, aclsManager, dirsHandler);
  bind(JAXBContextResolver.class);
  bind(NMWebServices.class);
  bind(GenericExceptionHandler.class);
  bind(Context.class).toInstance(nmContext);
  bind(WebApp.class).toInstance(nmWebApp);
  bind(ResourceView.class).toInstance(resourceView);
  bind(ApplicationACLsManager.class).toInstance(aclsManager);
  bind(LocalDirsHandlerService.class).toInstance(dirsHandler);

  serve("/*").with(GuiceContainer.class);
}