当前位置: 首页>>代码示例>>Java>>正文


Java NMClient类代码示例

本文整理汇总了Java中org.apache.hadoop.yarn.client.api.NMClient的典型用法代码示例。如果您正苦于以下问题:Java NMClient类的具体用法?Java NMClient怎么用?Java NMClient使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


NMClient类属于org.apache.hadoop.yarn.client.api包,在下文中一共展示了NMClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: TestingYarnFlinkResourceManager

import org.apache.hadoop.yarn.client.api.NMClient; //导入依赖的package包/类
public TestingYarnFlinkResourceManager(
	Configuration flinkConfig,
	YarnConfiguration yarnConfig,
	LeaderRetrievalService leaderRetrievalService,
	String applicationMasterHostName,
	String webInterfaceURL,
	ContaineredTaskManagerParameters taskManagerParameters,
	ContainerLaunchContext taskManagerLaunchContext,
	int yarnHeartbeatIntervalMillis,
	int maxFailedContainers,
	int numInitialTaskManagers,
	YarnResourceManagerCallbackHandler callbackHandler,
	AMRMClientAsync<AMRMClient.ContainerRequest> resourceManagerClient,
	NMClient nodeManagerClient) {
	super(flinkConfig, yarnConfig, leaderRetrievalService, applicationMasterHostName, webInterfaceURL, taskManagerParameters, taskManagerLaunchContext, yarnHeartbeatIntervalMillis, maxFailedContainers, numInitialTaskManagers, callbackHandler, resourceManagerClient, nodeManagerClient);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:17,代码来源:TestingYarnFlinkResourceManager.java

示例2: SolrMaster

import org.apache.hadoop.yarn.client.api.NMClient; //导入依赖的package包/类
public SolrMaster(CommandLine cli) throws Exception {
  this.cli = cli;
  Configuration hadoopConf = new Configuration();
  if (cli.hasOption("conf")) {
    hadoopConf.addResource(new Path(cli.getOptionValue("conf")));
    hadoopConf.reloadConfiguration();
  }
  conf = new YarnConfiguration(hadoopConf);

  nmClient = NMClient.createNMClient();
  nmClient.init(conf);
  nmClient.start();
  numContainersToWaitFor = Integer.parseInt(cli.getOptionValue("nodes"));
  memory = Integer.parseInt(cli.getOptionValue("memory", "512"));
  port = Integer.parseInt(cli.getOptionValue("port"));
  nextPort = port;

  SecureRandom random = new SecureRandom();
  this.randomStopKey = new BigInteger(130, random).toString(32);

  this.inetAddresses = getMyInetAddresses();
}
 
开发者ID:lucidworks,项目名称:yarn-proto,代码行数:23,代码来源:SolrMaster.java

示例3: StormAMRMClient

import org.apache.hadoop.yarn.client.api.NMClient; //导入依赖的package包/类
public StormAMRMClient(ApplicationAttemptId appAttemptId,
                       @SuppressWarnings("rawtypes") Map storm_conf,
                       YarnConfiguration hadoopConf) {
  this.appAttemptId = appAttemptId;
  this.storm_conf = storm_conf;
  this.hadoopConf = hadoopConf;
  Integer pri = Utils.getInt(storm_conf.get(Config.MASTER_CONTAINER_PRIORITY));
  this.DEFAULT_PRIORITY.setPriority(pri);
  this.containers = new TreeSet<Container>();
  numSupervisors = new AtomicInteger(0);

  // start am nm client
  nmClient = (NMClientImpl) NMClient.createNMClient();
  nmClient.init(hadoopConf);
  nmClient.start();
}
 
开发者ID:yahoo,项目名称:storm-yarn,代码行数:17,代码来源:StormAMRMClient.java

示例4: NMClientAsyncImpl

import org.apache.hadoop.yarn.client.api.NMClient; //导入依赖的package包/类
@Private
@VisibleForTesting
protected NMClientAsyncImpl(String name, NMClient client,
    CallbackHandler callbackHandler) {
  super(name, client, callbackHandler);
  this.client = client;
  this.callbackHandler = callbackHandler;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:NMClientAsyncImpl.java

示例5: NMClientAsync

import org.apache.hadoop.yarn.client.api.NMClient; //导入依赖的package包/类
@Private
@VisibleForTesting
protected NMClientAsync(String name, NMClient client,
    CallbackHandler callbackHandler) {
  super(name);
  this.setClient(client);
  this.setCallbackHandler(callbackHandler);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:NMClientAsync.java

示例6: mockNMClient

import org.apache.hadoop.yarn.client.api.NMClient; //导入依赖的package包/类
private NMClient mockNMClient(int mode)
    throws YarnException, IOException {
  NMClient client = mock(NMClient.class);
  switch (mode) {
    case 0:
      when(client.startContainer(any(Container.class),
          any(ContainerLaunchContext.class))).thenReturn(
              Collections.<String, ByteBuffer>emptyMap());
      when(client.getContainerStatus(any(ContainerId.class),
          any(NodeId.class))).thenReturn(
              recordFactory.newRecordInstance(ContainerStatus.class));
      doNothing().when(client).stopContainer(any(ContainerId.class),
          any(NodeId.class));
      break;
    case 1:
      doThrow(RPCUtil.getRemoteException("Start Exception")).when(client)
          .startContainer(any(Container.class),
              any(ContainerLaunchContext.class));
      doThrow(RPCUtil.getRemoteException("Query Exception")).when(client)
          .getContainerStatus(any(ContainerId.class), any(NodeId.class));
      doThrow(RPCUtil.getRemoteException("Stop Exception")).when(client)
          .stopContainer(any(ContainerId.class), any(NodeId.class));
      break;
    case 2:
      when(client.startContainer(any(Container.class),
          any(ContainerLaunchContext.class))).thenReturn(
              Collections.<String, ByteBuffer>emptyMap());
      when(client.getContainerStatus(any(ContainerId.class),
          any(NodeId.class))).thenReturn(
              recordFactory.newRecordInstance(ContainerStatus.class));
      doThrow(RPCUtil.getRemoteException("Stop Exception")).when(client)
          .stopContainer(any(ContainerId.class), any(NodeId.class));
  }
  return client;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:36,代码来源:TestNMClientAsync.java

示例7: NMClientAsyncImpl

import org.apache.hadoop.yarn.client.api.NMClient; //导入依赖的package包/类
@Private
@VisibleForTesting
protected NMClientAsyncImpl(String name, NMClient client,
    AbstractCallbackHandler callbackHandler) {
  super(name, client, callbackHandler);
  this.client = client;
  this.callbackHandler = callbackHandler;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:9,代码来源:NMClientAsyncImpl.java

示例8: NMClientAsync

import org.apache.hadoop.yarn.client.api.NMClient; //导入依赖的package包/类
@Private
@VisibleForTesting
@Deprecated
protected NMClientAsync(String name, NMClient client,
    CallbackHandler callbackHandler) {
  super(name);
  this.setClient(client);
  this.setCallbackHandler(callbackHandler);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:10,代码来源:NMClientAsync.java

示例9: testAMRMClientWithContainerResourceChange

import org.apache.hadoop.yarn.client.api.NMClient; //导入依赖的package包/类
@Test(timeout=60000)
public void testAMRMClientWithContainerResourceChange()
    throws YarnException, IOException {
  AMRMClient<ContainerRequest> amClient = null;
  try {
    // start am rm client
    amClient = AMRMClient.createAMRMClient();
    Assert.assertNotNull(amClient);
    // asserting we are using the singleton instance cache
    Assert.assertSame(
        NMTokenCache.getSingleton(), amClient.getNMTokenCache());
    amClient.init(conf);
    amClient.start();
    assertEquals(STATE.STARTED, amClient.getServiceState());
    // start am nm client
    NMClientImpl nmClient = (NMClientImpl) NMClient.createNMClient();
    Assert.assertNotNull(nmClient);
    // asserting we are using the singleton instance cache
    Assert.assertSame(
        NMTokenCache.getSingleton(), nmClient.getNMTokenCache());
    nmClient.init(conf);
    nmClient.start();
    assertEquals(STATE.STARTED, nmClient.getServiceState());
    // am rm client register the application master with RM
    amClient.registerApplicationMaster("Host", 10000, "");
    // allocate three containers and make sure they are in RUNNING state
    List<Container> containers =
        allocateAndStartContainers(amClient, nmClient, 3);
    // perform container resource increase and decrease tests
    doContainerResourceChange(amClient, containers);
    // unregister and finish up the test
    amClient.unregisterApplicationMaster(FinalApplicationStatus.SUCCEEDED,
        null, null);
  } finally {
    if (amClient != null && amClient.getServiceState() == STATE.STARTED) {
      amClient.stop();
    }
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:40,代码来源:TestAMRMClient.java

示例10: mockNMClient

import org.apache.hadoop.yarn.client.api.NMClient; //导入依赖的package包/类
private NMClient mockNMClient(int mode)
    throws YarnException, IOException {
  NMClient client = mock(NMClient.class);
  switch (mode) {
    case 0:
      when(client.startContainer(any(Container.class),
          any(ContainerLaunchContext.class))).thenReturn(
              Collections.<String, ByteBuffer>emptyMap());
      when(client.getContainerStatus(any(ContainerId.class),
          any(NodeId.class))).thenReturn(
              recordFactory.newRecordInstance(ContainerStatus.class));
      doNothing().when(client).increaseContainerResource(
          any(Container.class));
      doNothing().when(client).stopContainer(any(ContainerId.class),
          any(NodeId.class));
      break;
    case 1:
      doThrow(RPCUtil.getRemoteException("Start Exception")).when(client)
          .startContainer(any(Container.class),
              any(ContainerLaunchContext.class));
      doThrow(RPCUtil.getRemoteException("Query Exception")).when(client)
          .getContainerStatus(any(ContainerId.class), any(NodeId.class));
      doThrow(RPCUtil.getRemoteException("Stop Exception")).when(client)
          .stopContainer(any(ContainerId.class), any(NodeId.class));
      break;
    case 2:
      when(client.startContainer(any(Container.class),
          any(ContainerLaunchContext.class))).thenReturn(
              Collections.<String, ByteBuffer>emptyMap());
      when(client.getContainerStatus(any(ContainerId.class),
          any(NodeId.class))).thenReturn(
              recordFactory.newRecordInstance(ContainerStatus.class));
      doThrow(RPCUtil.getRemoteException("Increase Resource Exception"))
          .when(client).increaseContainerResource(any(Container.class));
      doThrow(RPCUtil.getRemoteException("Stop Exception")).when(client)
          .stopContainer(any(ContainerId.class), any(NodeId.class));
  }
  return client;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:40,代码来源:TestNMClientAsync.java

示例11: launch

import org.apache.hadoop.yarn.client.api.NMClient; //导入依赖的package包/类
@Override
public void launch(int n, List<String> command, List<String> hosts,
    boolean verbose) throws Exception {
  final List<String> chmod = new ArrayList<String>();
  chmod.add("chmod");
  chmod.add("a+rx");
  chmod.add(System.getenv(Environment.LOG_DIRS.name()));
  final ProcessBuilder pb = new ProcessBuilder(chmod);
  pb.redirectOutput(Redirect.INHERIT);
  pb.redirectError(Redirect.INHERIT);
  pb.start();
  redirect(command); // TODO clone before mutating the command
  rmClient.init(conf);
  rmClient.start();
  final NMClient nmClient = NMClient.createNMClient();
  nmClient.init(conf);
  nmClient.start();
  rmClient.registerApplicationMaster("", 0, "");
  for (int i = 0; i < n; ++i) {
    final ContainerRequest request = new ContainerRequest(
        Resource.newInstance(256, 1), null, null, Priority.newInstance(0));
    rmClient.addContainerRequest(request);
  }
  int responseId = 0;
  for (int containers = 0; containers < n;) {
    final AllocateResponse response = rmClient.allocate(responseId++);
    for (final Container container : response.getAllocatedContainers()) {
      final ContainerLaunchContext ctx = ContainerLaunchContext
          .newInstance(null, null, command, null, null, null);
      nmClient.startContainer(container, ctx);
    }
    containers += response.getAllocatedContainers().size();
    try {
      Thread.sleep(100);
    } catch (final InterruptedException e) {
    }
  }
}
 
开发者ID:x10-lang,项目名称:apgas,代码行数:39,代码来源:Launcher.java

示例12: ApplicationMaster

import org.apache.hadoop.yarn.client.api.NMClient; //导入依赖的package包/类
public ApplicationMaster() {
    this.allocatedContainerMap = new HashMap<String, Container>();
    this.sendQueue = new ArrayBlockingQueue<JSONObject>(512);
    this.configuration = new YarnConfiguration();
    this.defaultLocalRes = new HashMap<String, LocalResource>();
    this.nmClient = NMClient.createNMClient();
    this.nmClient.init(this.configuration);
    this.nmClient.start();
}
 
开发者ID:kazuki,项目名称:hadoop-yarn-appmaster-bridge,代码行数:10,代码来源:ApplicationMaster.java

示例13: start

import org.apache.hadoop.yarn.client.api.NMClient; //导入依赖的package包/类
public void start() {
    if (client != null) {
        return;
    }

    client = NMClient.createNMClient("Elasticsearch-YARN");
    YarnCompat.setNMTokenCache(client, tokenCache);
    client.init(cfg);
    client.start();
}
 
开发者ID:xushjie1987,项目名称:es-hadoop-v2.2.0,代码行数:11,代码来源:NodeMasterRpc.java

示例14: createAndStartNodeManagerClient

import org.apache.hadoop.yarn.client.api.NMClient; //导入依赖的package包/类
protected NMClient createAndStartNodeManagerClient(YarnConfiguration yarnConfiguration) {
	// create the client to communicate with the node managers
	NMClient nodeManagerClient = NMClient.createNMClient();
	nodeManagerClient.init(yarnConfiguration);
	nodeManagerClient.start();
	nodeManagerClient.cleanupRunningContainersOnStop(true);
	return nodeManagerClient;
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:9,代码来源:YarnResourceManager.java

示例15: YarnFlinkResourceManager

import org.apache.hadoop.yarn.client.api.NMClient; //导入依赖的package包/类
public YarnFlinkResourceManager(
	Configuration flinkConfig,
	YarnConfiguration yarnConfig,
	LeaderRetrievalService leaderRetrievalService,
	String applicationMasterHostName,
	String webInterfaceURL,
	ContaineredTaskManagerParameters taskManagerParameters,
	ContainerLaunchContext taskManagerLaunchContext,
	int yarnHeartbeatIntervalMillis,
	int maxFailedContainers,
	int numInitialTaskManagers,
	YarnResourceManagerCallbackHandler callbackHandler) {

	this(
		flinkConfig,
		yarnConfig,
		leaderRetrievalService,
		applicationMasterHostName,
		webInterfaceURL,
		taskManagerParameters,
		taskManagerLaunchContext,
		yarnHeartbeatIntervalMillis,
		maxFailedContainers,
		numInitialTaskManagers,
		callbackHandler,
		AMRMClientAsync.createAMRMClientAsync(yarnHeartbeatIntervalMillis, callbackHandler),
		NMClient.createNMClient());
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:29,代码来源:YarnFlinkResourceManager.java


注:本文中的org.apache.hadoop.yarn.client.api.NMClient类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。