當前位置: 首頁>>代碼示例>>Java>>正文


Java VersionInfo類代碼示例

本文整理匯總了Java中org.apache.hadoop.util.VersionInfo的典型用法代碼示例。如果您正苦於以下問題:Java VersionInfo類的具體用法?Java VersionInfo怎麽用?Java VersionInfo使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


VersionInfo類屬於org.apache.hadoop.util包,在下文中一共展示了VersionInfo類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createOutputCommitter

import org.apache.hadoop.util.VersionInfo; //導入依賴的package包/類
private org.apache.hadoop.mapreduce.OutputCommitter
createOutputCommitter(boolean newApiCommitter, JobID jobId, Configuration conf) throws IOException, InterruptedException, ClassNotFoundException {
    org.apache.hadoop.mapreduce.OutputCommitter committer = null;

    LOG.info("OutputCommitter set in config "
            + conf.get("mapred.output.committer.class"));

    if (newApiCommitter) {
        HadoopVersionSpecificCode hadoopVersionSpecificCode = HadoopVersionSpecificCode.getInstance(VersionInfo.getVersion(), conf);
        org.apache.hadoop.mapreduce.TaskAttemptID taskAttemptID = hadoopVersionSpecificCode.createTaskAttemptId(jobId, true, 0);
        org.apache.hadoop.mapreduce.TaskAttemptContext taskContext = hadoopVersionSpecificCode.createTaskAttemptContext(conf, taskAttemptID);
        OutputFormat outputFormat =
                ReflectionUtils.newInstance(taskContext.getOutputFormatClass(), conf);
        committer = outputFormat.getOutputCommitter(taskContext);
    } else {
        committer = ReflectionUtils.newInstance(conf.getClass(
                "mapred.output.committer.class", FileOutputCommitter.class,
                org.apache.hadoop.mapred.OutputCommitter.class), conf);
    }
    LOG.info("OutputCommitter is " + committer.getClass().getName());
    return committer;
}
 
開發者ID:scaleoutsoftware,項目名稱:hServer,代碼行數:23,代碼來源:JobScheduler.java

示例2: ClusterInfo

import org.apache.hadoop.util.VersionInfo; //導入依賴的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

示例3: buildRoot

import org.apache.hadoop.util.VersionInfo; //導入依賴的package包/類
/**
 * Build a map from the query string, setting values and defaults.
 */
protected Map<String,String> buildRoot(HttpServletRequest request,
    XMLOutputter doc) {
  final String path = ServletUtil.getDecodedPath(request, "/listPaths");
  final String exclude = request.getParameter("exclude") != null
    ? request.getParameter("exclude") : "";
  final String filter = request.getParameter("filter") != null
    ? request.getParameter("filter") : ".*";
  final boolean recur = request.getParameter("recursive") != null
    && "yes".equals(request.getParameter("recursive"));

  Map<String, String> root = new HashMap<String, String>();
  root.put("path", path);
  root.put("recursive", recur ? "yes" : "no");
  root.put("filter", filter);
  root.put("exclude", exclude);
  root.put("time", df.get().format(new Date()));
  root.put("version", VersionInfo.getVersion());
  return root;
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:23,代碼來源:ListPathsServlet.java

示例4: checkNNVersion

import org.apache.hadoop.util.VersionInfo; //導入依賴的package包/類
private void checkNNVersion(NamespaceInfo nsInfo)
    throws IncorrectVersionException {
  // build and layout versions should match
  String nnVersion = nsInfo.getSoftwareVersion();
  String minimumNameNodeVersion = dnConf.getMinimumNameNodeVersion();
  if (VersionUtil.compareVersions(nnVersion, minimumNameNodeVersion) < 0) {
    IncorrectVersionException ive = new IncorrectVersionException(
        minimumNameNodeVersion, nnVersion, "NameNode", "DataNode");
    LOG.warn(ive.getMessage());
    throw ive;
  }
  String dnVersion = VersionInfo.getVersion();
  if (!nnVersion.equals(dnVersion)) {
    LOG.info("Reported NameNode version '" + nnVersion + "' does not match " +
        "DataNode version '" + dnVersion + "' but is within acceptable " +
        "limits. Note: This is normal during a rolling upgrade.");
  }
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:19,代碼來源:BPServiceActor.java

示例5: register

import org.apache.hadoop.util.VersionInfo; //導入依賴的package包/類
void register() throws IOException {
  // get versions from the namenode
  nsInfo = nameNodeProto.versionRequest();
  dnRegistration = new DatanodeRegistration(
      new DatanodeID(DNS.getDefaultIP("default"),
          DNS.getDefaultHost("default", "default"),
          DataNode.generateUuid(), getNodePort(dnIdx),
          DFSConfigKeys.DFS_DATANODE_HTTP_DEFAULT_PORT,
          DFSConfigKeys.DFS_DATANODE_HTTPS_DEFAULT_PORT,
          DFSConfigKeys.DFS_DATANODE_IPC_DEFAULT_PORT),
      new DataStorage(nsInfo),
      new ExportedBlockKeys(), VersionInfo.getVersion());
  // register datanode
  dnRegistration = nameNodeProto.registerDatanode(dnRegistration);
  //first block reports
  storage = new DatanodeStorage(DatanodeStorage.generateUuid());
  final StorageBlockReport[] reports = {
      new StorageBlockReport(storage, BlockListAsLongs.EMPTY)
  };
  nameNodeProto.blockReport(dnRegistration, 
      nameNode.getNamesystem().getBlockPoolId(), reports,
          new BlockReportContext(1, 0, System.nanoTime()));
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:24,代碼來源:NNThroughputBenchmark.java

示例6: setUp

import org.apache.hadoop.util.VersionInfo; //導入依賴的package包/類
@Before
public void setUp() throws IOException {
  mockDnConf = mock(DNConf.class);
  doReturn(VersionInfo.getVersion()).when(mockDnConf).getMinimumNameNodeVersion();
  
  DataNode mockDN = mock(DataNode.class);
  doReturn(true).when(mockDN).shouldRun();
  doReturn(mockDnConf).when(mockDN).getDnConf();
  
  BPOfferService mockBPOS = mock(BPOfferService.class);
  doReturn(mockDN).when(mockBPOS).getDataNode();
  
  actor = new BPServiceActor(INVALID_ADDR, mockBPOS);

  fakeNsInfo = mock(NamespaceInfo.class);
  // Return a a good software version.
  doReturn(VersionInfo.getVersion()).when(fakeNsInfo).getSoftwareVersion();
  // Return a good layout version for now.
  doReturn(HdfsConstants.NAMENODE_LAYOUT_VERSION).when(fakeNsInfo)
      .getLayoutVersion();
  
  DatanodeProtocolClientSideTranslatorPB fakeDnProt = 
      mock(DatanodeProtocolClientSideTranslatorPB.class);
  when(fakeDnProt.versionRequest()).thenReturn(fakeNsInfo);
  actor.setNameNode(fakeDnProt);
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:27,代碼來源:TestDatanodeRegister.java

示例7: testSoftwareVersionDifferences

import org.apache.hadoop.util.VersionInfo; //導入依賴的package包/類
@Test
public void testSoftwareVersionDifferences() throws Exception {
  // We expect no exception to be thrown when the software versions match.
  assertEquals(VersionInfo.getVersion(),
      actor.retrieveNamespaceInfo().getSoftwareVersion());
  
  // We expect no exception to be thrown when the min NN version is below the
  // reported NN version.
  doReturn("4.0.0").when(fakeNsInfo).getSoftwareVersion();
  doReturn("3.0.0").when(mockDnConf).getMinimumNameNodeVersion();
  assertEquals("4.0.0", actor.retrieveNamespaceInfo().getSoftwareVersion());
  
  // When the NN reports a version that's too low, throw an exception.
  doReturn("3.0.0").when(fakeNsInfo).getSoftwareVersion();
  doReturn("4.0.0").when(mockDnConf).getMinimumNameNodeVersion();
  try {
    actor.retrieveNamespaceInfo();
    fail("Should have thrown an exception for NN with too-low version");
  } catch (IncorrectVersionException ive) {
    GenericTestUtils.assertExceptionContains(
        "The reported NameNode version is too low", ive);
    LOG.info("Got expected exception", ive);
  }
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:25,代碼來源:TestDatanodeRegister.java

示例8: NodeInfo

import org.apache.hadoop.util.VersionInfo; //導入依賴的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: ClusterInfo

import org.apache.hadoop.util.VersionInfo; //導入依賴的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

示例10: register

import org.apache.hadoop.util.VersionInfo; //導入依賴的package包/類
void register() throws IOException {
  // get versions from the namenode
  nsInfo = nameNodeProto.versionRequest();
  dnRegistration = new DatanodeRegistration(
      new DatanodeID(DNS.getDefaultIP("default"),
          DNS.getDefaultHost("default", "default"),
          DataNode.generateUuid(), getNodePort(dnIdx),
          DFSConfigKeys.DFS_DATANODE_HTTP_DEFAULT_PORT,
          DFSConfigKeys.DFS_DATANODE_HTTPS_DEFAULT_PORT,
          DFSConfigKeys.DFS_DATANODE_IPC_DEFAULT_PORT),
      new DataStorage(nsInfo),
      new ExportedBlockKeys(), VersionInfo.getVersion());
  // register datanode
  dnRegistration = dataNodeProto.registerDatanode(dnRegistration);
  dnRegistration.setNamespaceInfo(nsInfo);
  //first block reports
  storage = new DatanodeStorage(DatanodeStorage.generateUuid());
  final StorageBlockReport[] reports = {
      new StorageBlockReport(storage, BlockListAsLongs.EMPTY)
  };
  dataNodeProto.blockReport(dnRegistration, bpid, reports,
          new BlockReportContext(1, 0, System.nanoTime(), 0L));
}
 
開發者ID:aliyun-beta,項目名稱:aliyun-oss-hadoop-fs,代碼行數:24,代碼來源:NNThroughputBenchmark.java

示例11: setUp

import org.apache.hadoop.util.VersionInfo; //導入依賴的package包/類
@Before
public void setUp() throws IOException {
  mockDnConf = mock(DNConf.class);
  doReturn(VersionInfo.getVersion()).when(mockDnConf).getMinimumNameNodeVersion();
  
  DataNode mockDN = mock(DataNode.class);
  doReturn(true).when(mockDN).shouldRun();
  doReturn(mockDnConf).when(mockDN).getDnConf();
  
  BPOfferService mockBPOS = mock(BPOfferService.class);
  doReturn(mockDN).when(mockBPOS).getDataNode();
  
  actor = new BPServiceActor(INVALID_ADDR, mockBPOS);

  fakeNsInfo = mock(NamespaceInfo.class);
  // Return a a good software version.
  doReturn(VersionInfo.getVersion()).when(fakeNsInfo).getSoftwareVersion();
  // Return a good layout version for now.
  doReturn(HdfsServerConstants.NAMENODE_LAYOUT_VERSION).when(fakeNsInfo)
      .getLayoutVersion();
  
  DatanodeProtocolClientSideTranslatorPB fakeDnProt = 
      mock(DatanodeProtocolClientSideTranslatorPB.class);
  when(fakeDnProt.versionRequest()).thenReturn(fakeNsInfo);
  actor.setNameNode(fakeDnProt);
}
 
開發者ID:aliyun-beta,項目名稱:aliyun-oss-hadoop-fs,代碼行數:27,代碼來源:TestDatanodeRegister.java

示例12: NodeInfo

import org.apache.hadoop.util.VersionInfo; //導入依賴的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

示例13: testSoftwareVersionDifferences

import org.apache.hadoop.util.VersionInfo; //導入依賴的package包/類
@Test
public void testSoftwareVersionDifferences() throws Exception {
  // We expect no exception to be thrown when the software versions match.
  assertEquals(VersionInfo.getVersion(),
      actor.retrieveNamespaceInfo().getSoftwareVersion());
  
  // We expect no exception to be thrown when the min NN version is below the
  // reported NN version.
  doReturn("4.0.0").when(fakeNsInfo).getSoftwareVersion();
  doReturn("3.0.0").when(mockDnConf).getMinimumNameNodeVersion();
  assertEquals("4.0.0", actor.retrieveNamespaceInfo().getSoftwareVersion());
  
  // When the NN reports a version that's too low, throw an exception.
  doReturn("3.0.0").when(fakeNsInfo).getSoftwareVersion();
  doReturn("4.0.0").when(mockDnConf).getMinimumNameNodeVersion();
  try {
    actor.retrieveNamespaceInfo();
    fail("Should have thrown an exception for NN with too-low version");
  } catch (IncorrectVersionException ive) {
    GenericTestUtils
        .assertExceptionContains("The reported NameNode version is too low",
            ive);
    LOG.info("Got expected exception", ive);
  }
}
 
開發者ID:hopshadoop,項目名稱:hops,代碼行數:26,代碼來源:TestDatanodeRegister.java

示例14: getVersionTable

import org.apache.hadoop.util.VersionInfo; //導入依賴的package包/類
/** Return a table containing version information. */
static String getVersionTable(FSNamesystem fsn) {
  StringBuilder sb = new StringBuilder();
  sb.append("<div class='dfstable'><table>");
  if (fsn != null) {
    sb.append("\n  <tr><td class='col1'>Started:</td><td>" + fsn.getStartTime());
  }
  sb.append("</td></tr>\n" + "\n  <tr><td class='col1'>Version:</td><td>");
  sb.append(VersionInfo.getVersion() + ", " + VersionInfo.getRevision());
  sb.append("</td></tr>\n" + "\n  <tr><td class='col1'>Compiled:</td><td>" + VersionInfo.getDate());
  sb.append(" by " + VersionInfo.getUser() + " from " + VersionInfo.getBranch());
  if (fsn != null) {
    sb.append("</td></tr>\n  <tr><td class='col1'>Cluster ID:</td><td>" + fsn.getClusterId());
    sb.append("</td></tr>\n  <tr><td class='col1'>Block Pool ID:</td><td>" + fsn.getBlockPoolId());
  }
  sb.append("</td></tr>\n</table></div>");
  return sb.toString();
}
 
開發者ID:Nextzero,項目名稱:hadoop-2.6.0-cdh5.4.3,代碼行數:19,代碼來源:NamenodeJspHelper.java

示例15: getVersionTable

import org.apache.hadoop.util.VersionInfo; //導入依賴的package包/類
/** Return a table containing version information. */
public static String getVersionTable(ServletContext context) {
  StringBuilder sb = new StringBuilder();
  final DataNode dataNode = (DataNode) context.getAttribute("datanode");
  sb.append("<div class='dfstable'><table>");
  sb.append("<tr><td class='col1'>Version:</td><td>");
  sb.append(VersionInfo.getVersion() + ", " + VersionInfo.getRevision());
  sb.append("</td></tr>\n" + "\n  <tr><td class='col1'>Compiled:</td><td>"
      + VersionInfo.getDate());
  sb.append(" by " + VersionInfo.getUser() + " from "
      + VersionInfo.getBranch());
  if (dataNode != null) {
    sb.append("</td></tr>\n  <tr><td class='col1'>Cluster ID:</td><td>"
        + dataNode.getClusterId());
  }
  sb.append("</td></tr>\n</table></div>");
  return sb.toString();
}
 
開發者ID:Nextzero,項目名稱:hadoop-2.6.0-cdh5.4.3,代碼行數:19,代碼來源:DatanodeJspHelper.java


注:本文中的org.apache.hadoop.util.VersionInfo類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。