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


Java YarnVersionInfo类代码示例

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


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

示例1: versionInfoGenerated

import org.apache.hadoop.yarn.util.YarnVersionInfo; //导入依赖的package包/类
/**
 * Test the yarn version info routines.
 * @throws IOException
 */
@Test
public void versionInfoGenerated() throws IOException {

  // can't easily know what the correct values are going to be so just
  // make sure they aren't Unknown
  assertTrue("getVersion returned Unknown", !YarnVersionInfo.getVersion().equals("Unknown"));
  assertTrue("getUser returned Unknown", !YarnVersionInfo.getUser().equals("Unknown"));
  assertTrue("getUrl returned Unknown", !YarnVersionInfo.getUrl().equals("Unknown"));
  assertTrue("getSrcChecksum returned Unknown", !YarnVersionInfo.getSrcChecksum().equals("Unknown"));

  // these could be Unknown if the VersionInfo generated from code not in svn or git
  // so just check that they return something
  assertNotNull("getRevision returned null", YarnVersionInfo.getRevision());
  assertNotNull("getBranch returned null", YarnVersionInfo.getBranch());

  assertTrue("getBuildVersion check doesn't contain: source checksum",
             YarnVersionInfo.getBuildVersion().contains("source checksum"));

}
 
开发者ID:naver,项目名称:hadoop,代码行数:24,代码来源:TestYarnVersionInfo.java

示例2: serviceStart

import org.apache.hadoop.yarn.util.YarnVersionInfo; //导入依赖的package包/类
@Override
protected void serviceStart() throws Exception {

  // NodeManager is the last service to start, so NodeId is available.
  this.nodeId = this.context.getNodeId();
  this.httpPort = this.context.getHttpPort();
  this.nodeManagerVersionId = YarnVersionInfo.getVersion();
  try {
    // Registration has to be in start so that ContainerManager can get the
    // perNM tokens needed to authenticate ContainerTokens.
    this.resourceTracker = getRMClient();
    registerWithRM();
    super.serviceStart();
    startStatusUpdater();
  } catch (Exception e) {
    String errorMessage = "Unexpected error starting NodeStatusUpdater";
    LOG.error(errorMessage, e);
    throw new YarnRuntimeException(e);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:NodeStatusUpdaterImpl.java

示例3: ClusterInfo

import org.apache.hadoop.yarn.util.YarnVersionInfo; //导入依赖的package包/类
public ClusterInfo(ResourceManager rm) {
  long ts = ResourceManager.getClusterTimeStamp();

  this.id = ts;
  this.state = rm.getServiceState();
  this.haState = rm.getRMContext().getHAServiceState();
  this.rmStateStoreName = rm.getRMContext().getStateStore().getClass()
      .getName();
  this.startedOn = ts;
  this.resourceManagerVersion = YarnVersionInfo.getVersion();
  this.resourceManagerBuildVersion = YarnVersionInfo.getBuildVersion();
  this.resourceManagerVersionBuiltOn = YarnVersionInfo.getDate();
  this.hadoopVersion = VersionInfo.getVersion();
  this.hadoopBuildVersion = VersionInfo.getBuildVersion();
  this.hadoopVersionBuiltOn = VersionInfo.getDate();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:ClusterInfo.java

示例4: NodeManager

import org.apache.hadoop.yarn.util.YarnVersionInfo; //导入依赖的package包/类
public NodeManager(String hostName, int containerManagerPort, int httpPort,
    String rackName, Resource capability,
    ResourceManager resourceManager)
    throws IOException, YarnException {
  this.containerManagerAddress = hostName + ":" + containerManagerPort;
  this.nodeHttpAddress = hostName + ":" + httpPort;
  this.rackName = rackName;
  this.resourceTrackerService = resourceManager.getResourceTrackerService();
  this.capability = capability;
  Resources.addTo(available, capability);
  this.nodeId = NodeId.newInstance(hostName, containerManagerPort);
  RegisterNodeManagerRequest request = recordFactory
      .newRecordInstance(RegisterNodeManagerRequest.class);
  request.setHttpPort(httpPort);
  request.setResource(capability);
  request.setNodeId(this.nodeId);
  request.setNMVersion(YarnVersionInfo.getVersion());
  resourceTrackerService.registerNodeManager(request);
  this.resourceManager = resourceManager;
  resourceManager.getResourceScheduler().getNodeReport(this.nodeId);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:NodeManager.java

示例5: testNodeRegistrationSuccess

import org.apache.hadoop.yarn.util.YarnVersionInfo; //导入依赖的package包/类
@Test
public void testNodeRegistrationSuccess() throws Exception {
  writeToHostsFile("host2");
  Configuration conf = new Configuration();
  conf.set(YarnConfiguration.RM_NODES_INCLUDE_FILE_PATH, hostFile
      .getAbsolutePath());
  rm = new MockRM(conf);
  rm.start();

  ResourceTrackerService resourceTrackerService = rm.getResourceTrackerService();
  RegisterNodeManagerRequest req = Records.newRecord(
      RegisterNodeManagerRequest.class);
  NodeId nodeId = NodeId.newInstance("host2", 1234);
  Resource capability = BuilderUtils.newResource(1024, 1, 1);
  req.setResource(capability);
  req.setNodeId(nodeId);
  req.setHttpPort(1234);
  req.setNMVersion(YarnVersionInfo.getVersion());
  // trying to register a invalid node.
  RegisterNodeManagerResponse response = resourceTrackerService.registerNodeManager(req);
  Assert.assertEquals(NodeAction.NORMAL,response.getNodeAction());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:TestResourceTrackerService.java

示例6: testResourceTrackerOnHA

import org.apache.hadoop.yarn.util.YarnVersionInfo; //导入依赖的package包/类
@Test(timeout = 15000)
public void testResourceTrackerOnHA() throws Exception {
  NodeId nodeId = NodeId.newInstance("localhost", 0);
  Resource resource = Resource.newInstance(2048, 4, 4);

  // make sure registerNodeManager works when failover happens
  RegisterNodeManagerRequest request =
      RegisterNodeManagerRequest.newInstance(nodeId, 0, resource,
          YarnVersionInfo.getVersion(), null, null);
  resourceTracker.registerNodeManager(request);
  Assert.assertTrue(waitForNodeManagerToConnect(10000, nodeId));

  // restart the failover thread, and make sure nodeHeartbeat works
  failoverThread = createAndStartFailoverThread();
  NodeStatus status =
      NodeStatus.newInstance(NodeId.newInstance("localhost", 0), 0, null,
          null, null);
  NodeHeartbeatRequest request2 =
      NodeHeartbeatRequest.newInstance(status, null, null);
  resourceTracker.nodeHeartbeat(request2);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:TestResourceTrackerOnHA.java

示例7: versionInfoGenerated

import org.apache.hadoop.yarn.util.YarnVersionInfo; //导入依赖的package包/类
/**
 * Test the yarn version info routines.
 * @throws IOException
 */
@Test
public void versionInfoGenerated() throws IOException {

  // can't easily know what the correct values are going to be so just
  // make sure they aren't Unknown
  assertTrue("getVersion returned Unknown", !YarnVersionInfo.getVersion().equals("Unknown"));
  assertTrue("getUser returned Unknown", !YarnVersionInfo.getUser().equals("Unknown"));
  assertTrue("getSrcChecksum returned Unknown", !YarnVersionInfo.getSrcChecksum().equals("Unknown"));

  // these could be Unknown if the VersionInfo generated from code not in svn or git
  // so just check that they return something
  assertNotNull("getUrl returned null", YarnVersionInfo.getUrl());
  assertNotNull("getRevision returned null", YarnVersionInfo.getRevision());
  assertNotNull("getBranch returned null", YarnVersionInfo.getBranch());

  assertTrue("getBuildVersion check doesn't contain: source checksum",
             YarnVersionInfo.getBuildVersion().contains("source checksum"));

}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:24,代码来源:TestYarnVersionInfo.java

示例8: NodeInfo

import org.apache.hadoop.yarn.util.YarnVersionInfo; //导入依赖的package包/类
public NodeInfo(final Context context, final ResourceView resourceView) {

    this.id = context.getNodeId().toString();
    this.nodeHostName = context.getNodeId().getHost();
    this.totalVmemAllocatedContainersMB = resourceView
        .getVmemAllocatedForContainers() / BYTES_IN_MB;
    this.vmemCheckEnabled = resourceView.isVmemCheckEnabled();
    this.totalPmemAllocatedContainersMB = resourceView
        .getPmemAllocatedForContainers() / BYTES_IN_MB;
    this.pmemCheckEnabled = resourceView.isPmemCheckEnabled();
    this.totalVCoresAllocatedContainers = resourceView
        .getVCoresAllocatedForContainers();
    this.nodeHealthy = context.getNodeHealthStatus().getIsNodeHealthy();
    this.lastNodeUpdateTime = context.getNodeHealthStatus()
        .getLastHealthReportTime();

    this.healthReport = context.getNodeHealthStatus().getHealthReport();

    this.nodeManagerVersion = YarnVersionInfo.getVersion();
    this.nodeManagerBuildVersion = YarnVersionInfo.getBuildVersion();
    this.nodeManagerVersionBuiltOn = YarnVersionInfo.getDate();
    this.hadoopVersion = VersionInfo.getVersion();
    this.hadoopBuildVersion = VersionInfo.getBuildVersion();
    this.hadoopVersionBuiltOn = VersionInfo.getDate();
    this.nmStartupTime = NodeManager.getNMStartupTime();
  }
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:27,代码来源:NodeInfo.java

示例9: serviceStart

import org.apache.hadoop.yarn.util.YarnVersionInfo; //导入依赖的package包/类
@Override
protected void serviceStart() throws Exception {

  // NodeManager is the last service to start, so NodeId is available.
  this.nodeId = this.context.getNodeId();
  LOG.info("Node ID assigned is : " + this.nodeId);
  this.httpPort = this.context.getHttpPort();
  this.nodeManagerVersionId = YarnVersionInfo.getVersion();
  try {
    // Registration has to be in start so that ContainerManager can get the
    // perNM tokens needed to authenticate ContainerTokens.
    this.resourceTracker = getRMClient();
    registerWithRM();
    super.serviceStart();
    startStatusUpdater();
  } catch (Exception e) {
    String errorMessage = "Unexpected error starting NodeStatusUpdater";
    LOG.error(errorMessage, e);
    throw new YarnRuntimeException(e);
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:22,代码来源:NodeStatusUpdaterImpl.java

示例10: ClusterInfo

import org.apache.hadoop.yarn.util.YarnVersionInfo; //导入依赖的package包/类
public ClusterInfo(ResourceManager rm) {
  long ts = ResourceManager.getClusterTimeStamp();

  this.id = ts;
  this.state = rm.getServiceState();
  this.haState = rm.getRMContext().getHAServiceState();
  this.rmStateStoreName = rm.getRMContext().getStateStore().getClass()
      .getName();
  this.startedOn = ts;
  this.resourceManagerVersion = YarnVersionInfo.getVersion();
  this.resourceManagerBuildVersion = YarnVersionInfo.getBuildVersion();
  this.resourceManagerVersionBuiltOn = YarnVersionInfo.getDate();
  this.hadoopVersion = VersionInfo.getVersion();
  this.hadoopBuildVersion = VersionInfo.getBuildVersion();
  this.hadoopVersionBuiltOn = VersionInfo.getDate();
  this.haZooKeeperConnectionState =
      rm.getRMContext().getRMAdminService().getHAZookeeperConnectionState();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:19,代码来源:ClusterInfo.java

示例11: testNodeRegistrationSuccess

import org.apache.hadoop.yarn.util.YarnVersionInfo; //导入依赖的package包/类
@Test
public void testNodeRegistrationSuccess() throws Exception {
  writeToHostsFile("host2");
  Configuration conf = new Configuration();
  conf.set(YarnConfiguration.RM_NODES_INCLUDE_FILE_PATH, hostFile
      .getAbsolutePath());
  rm = new MockRM(conf);
  rm.start();

  ResourceTrackerService resourceTrackerService = rm.getResourceTrackerService();
  RegisterNodeManagerRequest req = Records.newRecord(
      RegisterNodeManagerRequest.class);
  NodeId nodeId = NodeId.newInstance("host2", 1234);
  Resource capability = BuilderUtils.newResource(1024, 1);
  req.setResource(capability);
  req.setNodeId(nodeId);
  req.setHttpPort(1234);
  req.setNMVersion(YarnVersionInfo.getVersion());
  // trying to register a invalid node.
  RegisterNodeManagerResponse response =
      resourceTrackerService.registerNodeManager(req);
  Assert.assertEquals(NodeAction.NORMAL, response.getNodeAction());
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:24,代码来源:TestResourceTrackerService.java

示例12: testResourceTrackerOnHA

import org.apache.hadoop.yarn.util.YarnVersionInfo; //导入依赖的package包/类
@Test(timeout = 15000)
public void testResourceTrackerOnHA() throws Exception {
  NodeId nodeId = NodeId.newInstance("localhost", 0);
  Resource resource = Resource.newInstance(2048, 4);

  // make sure registerNodeManager works when failover happens
  RegisterNodeManagerRequest request =
      RegisterNodeManagerRequest.newInstance(nodeId, 0, resource,
          YarnVersionInfo.getVersion(), null, null);
  resourceTracker.registerNodeManager(request);
  Assert.assertTrue(waitForNodeManagerToConnect(10000, nodeId));

  // restart the failover thread, and make sure nodeHeartbeat works
  failoverThread = createAndStartFailoverThread();
  NodeStatus status =
      NodeStatus.newInstance(NodeId.newInstance("localhost", 0), 0, null,
          null, null, null, null, null);
  NodeHeartbeatRequest request2 =
      NodeHeartbeatRequest.newInstance(status, null, null,null);
  resourceTracker.nodeHeartbeat(request2);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:22,代码来源:TestResourceTrackerOnHA.java

示例13: NodeInfo

import org.apache.hadoop.yarn.util.YarnVersionInfo; //导入依赖的package包/类
public NodeInfo(final Context context, final ResourceView resourceView) {

    this.id = context.getNodeId().toString();
    this.nodeHostName = context.getNodeId().getHost();
    this.totalVmemAllocatedContainersMB = resourceView
        .getVmemAllocatedForContainers() / BYTES_IN_MB;
    this.vmemCheckEnabled = resourceView.isVmemCheckEnabled();
    this.totalPmemAllocatedContainersMB = resourceView
        .getPmemAllocatedForContainers() / BYTES_IN_MB;
    this.pmemCheckEnabled = resourceView.isPmemCheckEnabled();
    this.totalVCoresAllocatedContainers = resourceView
        .getVCoresAllocatedForContainers();
    this.nodeHealthy = context.getNodeHealthStatus().getIsNodeHealthy();
    this.lastNodeUpdateTime = context.getNodeHealthStatus()
        .getLastHealthReportTime();

    this.healthReport = context.getNodeHealthStatus().getHealthReport();

    this.nodeManagerVersion = YarnVersionInfo.getVersion();
    this.nodeManagerBuildVersion = YarnVersionInfo.getBuildVersion();
    this.nodeManagerVersionBuiltOn = YarnVersionInfo.getDate();
    this.hadoopVersion = VersionInfo.getVersion();
    this.hadoopBuildVersion = VersionInfo.getBuildVersion();
    this.hadoopVersionBuiltOn = VersionInfo.getDate();
  }
 
开发者ID:yncxcw,项目名称:big-c,代码行数:26,代码来源:NodeInfo.java

示例14: testNodeRegistrationSuccess

import org.apache.hadoop.yarn.util.YarnVersionInfo; //导入依赖的package包/类
@Test
public void testNodeRegistrationSuccess() throws Exception {
  writeToHostsFile("host2");
  Configuration conf = new Configuration();
  conf.set(YarnConfiguration.RM_NODES_INCLUDE_FILE_PATH, hostFile
      .getAbsolutePath());
  rm = new MockRM(conf);
  rm.start();

  ResourceTrackerService resourceTrackerService = rm.getResourceTrackerService();
  RegisterNodeManagerRequest req = Records.newRecord(
      RegisterNodeManagerRequest.class);
  NodeId nodeId = NodeId.newInstance("host2", 1234);
  Resource capability = BuilderUtils.newResource(1024, 1);
  req.setResource(capability);
  req.setNodeId(nodeId);
  req.setHttpPort(1234);
  req.setNMVersion(YarnVersionInfo.getVersion());
  // trying to register a invalid node.
  RegisterNodeManagerResponse response = resourceTrackerService.registerNodeManager(req);
  Assert.assertEquals(NodeAction.NORMAL,response.getNodeAction());
}
 
开发者ID:yncxcw,项目名称:big-c,代码行数:23,代码来源:TestResourceTrackerService.java

示例15: testResourceTrackerOnHA

import org.apache.hadoop.yarn.util.YarnVersionInfo; //导入依赖的package包/类
@Test(timeout = 15000)
public void testResourceTrackerOnHA() throws Exception {
  NodeId nodeId = NodeId.newInstance("localhost", 0);
  Resource resource = Resource.newInstance(2048, 4);

  // make sure registerNodeManager works when failover happens
  RegisterNodeManagerRequest request =
      RegisterNodeManagerRequest.newInstance(nodeId, 0, resource,
          YarnVersionInfo.getVersion(), null, null);
  resourceTracker.registerNodeManager(request);
  Assert.assertTrue(waitForNodeManagerToConnect(10000, nodeId));

  // restart the failover thread, and make sure nodeHeartbeat works
  failoverThread = createAndStartFailoverThread();
  NodeStatus status =
      NodeStatus.newInstance(NodeId.newInstance("localhost", 0), 0, null,
          null, null);
  NodeHeartbeatRequest request2 =
      NodeHeartbeatRequest.newInstance(status, null, null);
  resourceTracker.nodeHeartbeat(request2);
}
 
开发者ID:yncxcw,项目名称:big-c,代码行数:22,代码来源:TestResourceTrackerOnHA.java


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