• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TaskTrackerStatus类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: verifyTTNotBlackListed

import org.apache.hadoop.mapred.TaskTrackerStatus; //导入依赖的package包/类
/**
 * Will verify that given task tracker is not blacklisted
 * @param client tasktracker info
 * @param conf modified configuration object
 * @param cluster mrcluster instance
 * @throws IOException thrown if verification fails
 */
public void verifyTTNotBlackListed(TTClient client, Configuration conf,
    MRCluster cluster) throws IOException {        
  int interval = conf.getInt("mapred.healthChecker.interval",0);
  Assert.assertTrue("Interval cannot be zero.",interval != 0);
  UtilsForTests.waitFor(interval+2000);
  String defaultHealthScript = conf.get("mapred.healthChecker.script.path");    
  Assert.assertTrue("Task tracker is not healthy",
      nodeHealthStatus(client, true) == true);
  TaskTrackerStatus status = client.getStatus();
  JTClient jclient = cluster.getJTClient();
  Assert.assertTrue("Failed to move task tracker to healthy list",
      jclient.getProxy().isBlackListed(status.getTrackerName()) == false);        
  Assert.assertTrue("Health script was not set",defaultHealthScript != null);
  
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:23,代码来源:HealthScriptHelper.java


示例2: verifyTTBlackList

import org.apache.hadoop.mapred.TaskTrackerStatus; //导入依赖的package包/类
/**
 * Verifies that the given task tracker is blacklisted
 * @param conf modified Configuration object
 * @param client tasktracker info
 * @param errorMessage that needs to be asserted
 * @param cluster mr cluster instance
 * @throws IOException is thrown when verification fails
 */
public void verifyTTBlackList(Configuration conf, TTClient client,
    String errorMessage, MRCluster cluster) throws IOException{   
  int interval = conf.getInt("mapred.healthChecker.interval",0);
  Assert.assertTrue("Interval cannot be zero.",interval != 0);
  UtilsForTests.waitFor(interval+2000);
  //TaskTrackerStatus status = client.getStatus();
  Assert.assertTrue("Task tracker was never blacklisted ",
      nodeHealthStatus(client, false) == true);
  TaskTrackerStatus status = client.getStatus();
  Assert.assertTrue("The custom error message did not appear",
      status.getHealthStatus().getHealthReport().trim().
      equals(errorMessage));
  JTClient jClient = cluster.getJTClient();    
  Assert.assertTrue("Failed to move task tracker to blacklisted list",
      jClient.getProxy().isBlackListed(status.getTrackerName()) == true);    
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:25,代码来源:HealthScriptHelper.java


示例3: nodeHealthStatus

import org.apache.hadoop.mapred.TaskTrackerStatus; //导入依赖的package包/类
/**
 * The method return true from the task tracker if it is unhealthy/healthy
 * depending the blacklisted status
 * @param client the tracker tracker instance
 * @param health status information. 
 * @return status of task tracker
 * @throws IOException failed to get the status of task tracker
 */
public boolean nodeHealthStatus(TTClient client,boolean hStatus) throws IOException {
  int counter = 0;
  TaskTrackerStatus status = client.getStatus();
  while (counter < 60) {
    LOG.info("isNodeHealthy "+status.getHealthStatus().isNodeHealthy());
    if (status.getHealthStatus().isNodeHealthy() == hStatus) {
      break;
    } else {
      UtilsForTests.waitFor(3000);
      status = client.getStatus();
      Assert.assertNotNull("Task tracker status is null",status);
    }
    counter++;
  }
  if(counter != 60) {
    return true;
  }
  return false;
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:28,代码来源:HealthScriptHelper.java


示例4: getCpuUsage

import org.apache.hadoop.mapred.TaskTrackerStatus; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public float getCpuUsage() {
  readProcStatFile();
  sampleTime = getCurrentTime();
  if (lastSampleTime == TaskTrackerStatus.UNAVAILABLE ||
      lastSampleTime > sampleTime) {
    // lastSampleTime > sampleTime may happen when the system time is changed
    lastSampleTime = sampleTime;
    lastCumulativeCpuTime = cumulativeCpuTime;
    return cpuUsage;
  }
  // When lastSampleTime is sufficiently old, update cpuUsage.
  // Also take a sample of the current time and cumulative CPU time for the
  // use of the next calculation.
  final long MINIMUM_UPDATE_INTERVAL = 10 * jiffyLengthInMillis;
  if (sampleTime > lastSampleTime + MINIMUM_UPDATE_INTERVAL) {
   cpuUsage = (float)(cumulativeCpuTime - lastCumulativeCpuTime) * 100F /
              ((float)(sampleTime - lastSampleTime) * getNumProcessors());
   lastSampleTime = sampleTime;
    lastCumulativeCpuTime = cumulativeCpuTime;
  }
  return cpuUsage;
}
 
开发者ID:rekhajoshm,项目名称:mapreduce-fork,代码行数:25,代码来源:LinuxResourceCalculatorPlugin.java


示例5: testParsingProcStatAndCpuFile

import org.apache.hadoop.mapred.TaskTrackerStatus; //导入依赖的package包/类
/**
 * Test parsing /proc/stat and /proc/cpuinfo
 * @throws IOException
 */
public void testParsingProcStatAndCpuFile() throws IOException {
  // Write fake /proc/cpuinfo file.
  long numProcessors = 8;
  long cpuFrequencyKHz = 2392781;
  String fileContent = "";
  for (int i = 0; i < numProcessors; i++) {
    fileContent += String.format(CPUINFO_FORMAT, i, cpuFrequencyKHz / 1000D) +
                   "\n";
  }
  File tempFile = new File(FAKE_CPUFILE);
  tempFile.deleteOnExit();
  FileWriter fWriter = new FileWriter(FAKE_CPUFILE);
  fWriter.write(fileContent);
  fWriter.close();
  assertEquals(plugin.getNumProcessors(), numProcessors);
  assertEquals(plugin.getCpuFrequency(), cpuFrequencyKHz);
  
  // Write fake /proc/stat file.
  long uTime = 54972994;
  long nTime = 188860;
  long sTime = 19803373;
  tempFile = new File(FAKE_STATFILE);
  tempFile.deleteOnExit();
  updateStatFile(uTime, nTime, sTime);
  assertEquals(plugin.getCumulativeCpuTime(),
               FAKE_JIFFY_LENGTH * (uTime + nTime + sTime));
  assertEquals(plugin.getCpuUsage(), (float)(TaskTrackerStatus.UNAVAILABLE));
  
  // Advance the time and sample again to test the CPU usage calculation
  uTime += 100L;
  plugin.advanceTime(200L);
  updateStatFile(uTime, nTime, sTime);
  assertEquals(plugin.getCumulativeCpuTime(),
               FAKE_JIFFY_LENGTH * (uTime + nTime + sTime));
  assertEquals(plugin.getCpuUsage(), 6.25F);
  
  // Advance the time and sample again. This time, we call getCpuUsage() only.
  uTime += 600L;
  plugin.advanceTime(300L);
  updateStatFile(uTime, nTime, sTime);
  assertEquals(plugin.getCpuUsage(), 25F);
  
  // Advance very short period of time (one jiffy length).
  // In this case, CPU usage should not be updated.
  uTime += 1L;
  plugin.advanceTime(1L);
  updateStatFile(uTime, nTime, sTime);
  assertEquals(plugin.getCumulativeCpuTime(),
               FAKE_JIFFY_LENGTH * (uTime + nTime + sTime));
  assertEquals(plugin.getCpuUsage(), 25F); // CPU usage is not updated.
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:56,代码来源:TestLinuxResourceCalculatorPlugin.java


示例6: TTInfoImpl

import org.apache.hadoop.mapred.TaskTrackerStatus; //导入依赖的package包/类
public TTInfoImpl() {
  taskTrackerName = "";
  status = new TaskTrackerStatus();
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:5,代码来源:TTInfoImpl.java


示例7: getStatus

import org.apache.hadoop.mapred.TaskTrackerStatus; //导入依赖的package包/类
@Override
public TaskTrackerStatus getStatus() {
  return status;
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:5,代码来源:TTInfoImpl.java


示例8: testParsingProcStatAndCpuFile

import org.apache.hadoop.mapred.TaskTrackerStatus; //导入依赖的package包/类
/**
 * Test parsing /proc/stat and /proc/cpuinfo
 * @throws IOException
 */
@Test
public void testParsingProcStatAndCpuFile() throws IOException {
  // Write fake /proc/cpuinfo file.
  long numProcessors = 8;
  long cpuFrequencyKHz = 2392781;
  String fileContent = "";
  for (int i = 0; i < numProcessors; i++) {
    fileContent += String.format(CPUINFO_FORMAT, i, cpuFrequencyKHz / 1000D) +
                   "\n";
  }
  File tempFile = new File(FAKE_CPUFILE);
  tempFile.deleteOnExit();
  FileWriter fWriter = new FileWriter(FAKE_CPUFILE);
  fWriter.write(fileContent);
  fWriter.close();
  assertEquals(plugin.getNumProcessors(), numProcessors);
  assertEquals(plugin.getCpuFrequency(), cpuFrequencyKHz);
  
  // Write fake /proc/stat file.
  long uTime = 54972994;
  long nTime = 188860;
  long sTime = 19803373;
  tempFile = new File(FAKE_STATFILE);
  tempFile.deleteOnExit();
  updateStatFile(uTime, nTime, sTime);
  assertEquals(plugin.getCumulativeCpuTime(),
               FAKE_JIFFY_LENGTH * (uTime + nTime + sTime));
  assertEquals(plugin.getCpuUsage(), (float)(TaskTrackerStatus.UNAVAILABLE));
  
  // Advance the time and sample again to test the CPU usage calculation
  uTime += 100L;
  plugin.advanceTime(200L);
  updateStatFile(uTime, nTime, sTime);
  assertEquals(plugin.getCumulativeCpuTime(),
               FAKE_JIFFY_LENGTH * (uTime + nTime + sTime));
  assertEquals(plugin.getCpuUsage(), 6.25F);
  
  // Advance the time and sample again. This time, we call getCpuUsage() only.
  uTime += 600L;
  plugin.advanceTime(300L);
  updateStatFile(uTime, nTime, sTime);
  assertEquals(plugin.getCpuUsage(), 25F);
  
  // Advance very short period of time (one jiffy length).
  // In this case, CPU usage should not be updated.
  uTime += 1L;
  plugin.advanceTime(1L);
  updateStatFile(uTime, nTime, sTime);
  assertEquals(plugin.getCumulativeCpuTime(),
               FAKE_JIFFY_LENGTH * (uTime + nTime + sTime));
  assertEquals(plugin.getCpuUsage(), 25F); // CPU usage is not updated.
}
 
开发者ID:rekhajoshm,项目名称:mapreduce-fork,代码行数:57,代码来源:TestLinuxResourceCalculatorPlugin.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ScoreboardTeam类代码示例发布时间:2022-05-23
下一篇:
Java FactoryRegistryException类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap