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

Java FakeClock类代码示例

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

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



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

示例1: startTT

import org.apache.hadoop.mapred.UtilsForTests.FakeClock; //导入依赖的package包/类
private void startTT(JobConf conf) throws IOException, InterruptedException {
  myClock = new FakeClock(); // clock is reset.
  String localdirs = TEST_ROOT_DIR + "/userlogs/local/0," + 
  					TEST_ROOT_DIR + "/userlogs/local/1";
  conf.set(JobConf.MAPRED_LOCAL_DIR_PROPERTY, localdirs);
  tt = new TaskTracker();
  tt.setConf(new JobConf(conf));
  LocalDirAllocator localDirAllocator = 
    new LocalDirAllocator("mapred.local.dir");
  tt.setLocalDirAllocator(localDirAllocator);
  LocalStorage localStorage = new LocalStorage(conf.getLocalDirs());
  LocalFileSystem localFs = FileSystem.getLocal(conf);
  localStorage.checkDirs(localFs, true);
  tt.setLocalStorage(localStorage);
  localizer = new Localizer(FileSystem.get(conf), conf
      .getTrimmedStrings(JobConf.MAPRED_LOCAL_DIR_PROPERTY));
  tt.setLocalizer(localizer);
  userLogManager = new UtilsForTests.InLineUserLogManager(conf);
  TaskController taskController = userLogManager.getTaskController();
  taskController.setup(localDirAllocator, localStorage);
  tt.setTaskController(taskController);
  userLogCleaner = userLogManager.getUserLogCleaner();
  userLogCleaner.setClock(myClock);
  tt.setUserLogManager(userLogManager);
  userLogManager.clearOldUserLogs(conf);
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:27,代码来源:TestUserLogCleanup.java


示例2: setUpCluster

import org.apache.hadoop.mapred.UtilsForTests.FakeClock; //导入依赖的package包/类
private void setUpCluster(int numRacks, int numNodesPerRack,
    boolean assignMultiple) throws IOException {
  
  resetMetrics();
  
  conf = new JobConf();
  conf.set("mapred.fairscheduler.allocation.file", ALLOC_FILE);
  conf.set("mapred.fairscheduler.poolnameproperty", POOL_PROPERTY);
  conf.setBoolean("mapred.fairscheduler.assignmultiple", assignMultiple);
  // Manually set locality delay because we aren't using a JobTracker so
  // we can't auto-compute it from the heartbeat interval.
  conf.setLong("mapred.fairscheduler.locality.delay", 10000);
  taskTrackerManager = new FakeTaskTrackerManager(numRacks, numNodesPerRack);
  clock = new FakeClock();
  scheduler = new FairScheduler(clock, true);
  scheduler.waitForMapsBeforeLaunchingReduces = false;
  scheduler.setConf(conf);
  scheduler.setTaskTrackerManager(taskTrackerManager);
  scheduler.start();
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:21,代码来源:TestFairScheduler.java


示例3: startTT

import org.apache.hadoop.mapred.UtilsForTests.FakeClock; //导入依赖的package包/类
private void startTT(JobConf conf) throws IOException, InterruptedException {
  myClock = new FakeClock(); // clock is reset.
  String localdirs = TEST_ROOT_DIR + "/userlogs/local/0," + 
  					TEST_ROOT_DIR + "/userlogs/local/1";
  conf.set(JobConf.MAPRED_LOCAL_DIR_PROPERTY, localdirs);
  tt = new TaskTracker();
  tt.setConf(new JobConf(conf));
  LocalDirAllocator localDirAllocator = 
  					new LocalDirAllocator("mapred.local.dir");
  localizer = new Localizer(FileSystem.get(conf), conf
      .getStrings(JobConf.MAPRED_LOCAL_DIR_PROPERTY));
  tt.setLocalizer(localizer);
  userLogManager = new UtilsForTests.InLineUserLogManager(conf);
  TaskController taskController = userLogManager.getTaskController();
  taskController.setup(localDirAllocator,
      new LocalStorage(conf.getStrings(JobConf.MAPRED_LOCAL_DIR_PROPERTY)));
  tt.setTaskController(taskController);
  userLogCleaner = userLogManager.getUserLogCleaner();
  userLogCleaner.setClock(myClock);
  tt.setUserLogManager(userLogManager);
  userLogManager.clearOldUserLogs(conf);
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre,代码行数:23,代码来源:TestUserLogCleanup.java


示例4: HFSPFakeJobInProgress

import org.apache.hadoop.mapred.UtilsForTests.FakeClock; //导入依赖的package包/类
public HFSPFakeJobInProgress(JobConf jobConf, FakeClock clock,
    HFSPFakeTaskTrackerManager taskTrackerManager, JobTracker jobTracker,
    String[][] mapInputLocations, JobTracker jt) throws IOException {
  super(new JobID("test", ++(HFSPFakeJobInProgress.jobCounter)), jobConf, jt);
  this.taskTrackerManager = taskTrackerManager;
  this.jobTracker = jobTracker;
  this.clock = clock;
  this.startTime = clock.time;
  this.mapInputLocations = mapInputLocations;
  this.startTime = System.currentTimeMillis();
  this.status = new JobStatus();
  this.status.setRunState(JobStatus.PREP);
  // this.nonLocalMaps = new LinkedList<TaskInProgress>();
  this.nonLocalRunningMaps = new LinkedHashSet<TaskInProgress>();
  this.runningMapCache = new IdentityHashMap<Node, Set<TaskInProgress>>();
  this.nonRunningReduces = new HashSet<TaskInProgress>();
  this.runningReduces = new LinkedHashSet<TaskInProgress>();
  // this.jobHistory = new FakeJobHistory();
  initTasks();
}
 
开发者ID:melrief,项目名称:HFSP,代码行数:21,代码来源:HFSPFakeJobInProgress.java


示例5: suite

import org.apache.hadoop.mapred.UtilsForTests.FakeClock; //导入依赖的package包/类
public static Test suite() {
  TestSetup setup = 
    new TestSetup(new TestSuite(TestRackAwareTaskPlacement.class)) {
    protected void setUp() throws Exception {
      JobConf conf = new JobConf();
      conf.set(JTConfig.JT_IPC_ADDRESS, "localhost:0");
      conf.set(JTConfig.JT_HTTP_ADDRESS, "0.0.0.0:0");
      conf.setClass("topology.node.switch.mapping.impl", 
        StaticMapping.class, DNSToSwitchMapping.class);
      conf.set(JTConfig.JT_INSTRUMENTATION,
          FakeJobTrackerMetricsInst.class.getName());
      jobTracker = new FakeJobTracker(conf, new FakeClock(), trackers);
      fakeInst = (FakeJobTrackerMetricsInst) jobTracker.getInstrumentation();
      // Set up the Topology Information
      for (int i = 0; i < allHosts.length; i++) {
        StaticMapping.addNodeToRack(allHosts[i], allRacks[i]);
      }
      for (String tracker : trackers) {
        FakeObjectUtilities.establishFirstContact(jobTracker, tracker);
      }
    }
  };
  return setup;
}
 
开发者ID:rekhajoshm,项目名称:mapreduce-fork,代码行数:25,代码来源:TestRackAwareTaskPlacement.java


示例6: suite

import org.apache.hadoop.mapred.UtilsForTests.FakeClock; //导入依赖的package包/类
public static Test suite() {
  TestSetup setup = 
    new TestSetup(new TestSuite(TestJobTrackerInstrumentation.class)) {
    protected void setUp() throws Exception {
      JobConf conf = new JobConf();
      conf.set(JTConfig.JT_IPC_ADDRESS, "localhost:0");
      conf.set(JTConfig.JT_HTTP_ADDRESS, "0.0.0.0:0");
      conf.setInt(JTConfig.JT_MAX_TRACKER_BLACKLISTS, 1);
      conf.setClass(JTConfig.JT_TASK_SCHEDULER, 
          FakeTaskScheduler.class, TaskScheduler.class);

      conf.set(JTConfig.JT_INSTRUMENTATION, 
          FakeJobTrackerMetricsInst.class.getName());
      jobTracker = new FakeJobTracker(conf, new FakeClock(), trackers);
      mi = (FakeJobTrackerMetricsInst) jobTracker.getInstrumentation();
      for (String tracker : trackers) {
        FakeObjectUtilities.establishFirstContact(jobTracker, tracker);
      }
      
    }
    protected void tearDown() throws Exception {
    }
  };
  return setup;
}
 
开发者ID:rekhajoshm,项目名称:mapreduce-fork,代码行数:26,代码来源:TestJobTrackerInstrumentation.java


示例7: suite

import org.apache.hadoop.mapred.UtilsForTests.FakeClock; //导入依赖的package包/类
public static Test suite() {
  TestSetup setup = new TestSetup(new TestSuite(TestJobInProgress.class)) {
    protected void setUp() throws Exception {
      JobConf conf = new JobConf();
      conf.set(JTConfig.JT_IPC_ADDRESS, "localhost:0");
      conf.set(JTConfig.JT_HTTP_ADDRESS, "0.0.0.0:0");
      conf.setClass("topology.node.switch.mapping.impl", 
          StaticMapping.class, DNSToSwitchMapping.class);
      jobTracker = new FakeJobTracker(conf, new FakeClock(), trackers);
      // Set up the Topology Information
      for (int i = 0; i < hosts.length; i++) {
        StaticMapping.addNodeToRack(hosts[i], racks[i]);
      }
      for (String s: trackers) {
        FakeObjectUtilities.establishFirstContact(jobTracker, s);
      }
    }
  };
  return setup;
}
 
开发者ID:rekhajoshm,项目名称:mapreduce-fork,代码行数:21,代码来源:TestJobInProgress.java


示例8: setUpCluster

import org.apache.hadoop.mapred.UtilsForTests.FakeClock; //导入依赖的package包/类
private void setUpCluster(int numRacks, int numNodesPerRack,
    boolean assignMultiple) {
  conf = new JobConf();
  conf.set("mapred.fairscheduler.allocation.file", ALLOC_FILE);
  conf.set("mapred.fairscheduler.poolnameproperty", POOL_PROPERTY);
  conf.setBoolean("mapred.fairscheduler.assignmultiple", assignMultiple);
  // Manually set locality delay because we aren't using a JobTracker so
  // we can't auto-compute it from the heartbeat interval.
  conf.setLong("mapred.fairscheduler.locality.delay.node", 5000);
  conf.setLong("mapred.fairscheduler.locality.delay.rack", 10000);
  taskTrackerManager = new FakeTaskTrackerManager(numRacks, numNodesPerRack);
  clock = new FakeClock();
  scheduler = new FairScheduler(clock, true);
  scheduler.waitForMapsBeforeLaunchingReduces = false;
  scheduler.setConf(conf);
  scheduler.setTaskTrackerManager(taskTrackerManager);
  scheduler.start();
}
 
开发者ID:rekhajoshm,项目名称:mapreduce-fork,代码行数:19,代码来源:TestFairScheduler.java


示例9: setUpCluster

import org.apache.hadoop.mapred.UtilsForTests.FakeClock; //导入依赖的package包/类
private void setUpCluster(int numRacks, int numNodesPerRack,
    boolean assignMultiple) throws IOException {
  
  resetMetrics();
  
  conf = new JobConf();
  conf.set("mapred.fairscheduler.allocation.file", ALLOC_FILE);
  conf.set("mapred.fairscheduler.poolnameproperty", POOL_PROPERTY);
  conf.setBoolean("mapred.fairscheduler.assignmultiple", assignMultiple);
  // Manually set locality delay because we aren't using a JobTracker so
  // we can't auto-compute it from the heartbeat interval.
  conf.setLong("mapred.fairscheduler.locality.delay.node", 5000);
  conf.setLong("mapred.fairscheduler.locality.delay.rack", 10000);
  conf.set("mapred.job.tracker", "localhost:0");
  conf.set("mapred.job.tracker.http.address", "0.0.0.0:0");
  taskTrackerManager = new FakeTaskTrackerManager(numRacks, numNodesPerRack);
  clock = new FakeClock();
  try {
    jobTracker = new JobTracker(conf, clock);
  } catch (Exception e) {
    throw new RuntimeException("Could not start JT", e);
  }
  scheduler = new FairScheduler(clock, true);
  scheduler.waitForMapsBeforeLaunchingReduces = false;
  scheduler.setConf(conf);
  scheduler.setTaskTrackerManager(taskTrackerManager);
  scheduler.start();
  // TaskStatus complains if a task's start time is 0, so advance it a bit
  advanceTime(100);
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre,代码行数:31,代码来源:TestFairScheduler.java


示例10: HFSPFakeTaskInProgress

import org.apache.hadoop.mapred.UtilsForTests.FakeClock; //导入依赖的package包/类
HFSPFakeTaskInProgress(JobID jId, JobTracker jobTracker, boolean isMap,
    int id, JobConf jobConf, HFSPFakeJobInProgress job,
    String[] inputLocations, JobSplit.TaskSplitMetaInfo split, FakeClock clock) {
  super(jId, "", split, jobTracker, jobConf, job, id, 1);
  this.clock = clock;
  this.isMap = isMap;
  this.fakeJob = job;
  this.inputLocations = inputLocations;
  activeTasks = new TreeMap<TaskAttemptID, String>();
  taskStatus = TaskStatus.createTaskStatus(isMap);
  taskStatus.setRunState(TaskStatus.State.UNASSIGNED);
}
 
开发者ID:melrief,项目名称:HFSP,代码行数:13,代码来源:HFSPFakeTaskInProgress.java


示例11: setUpCluster

import org.apache.hadoop.mapred.UtilsForTests.FakeClock; //导入依赖的package包/类
private void setUpCluster(int numRacks, int numNodesPerRack,
    boolean assignMultiple) throws IOException, IllegalArgumentException,
    InstantiationException, IllegalAccessException,
    InvocationTargetException, InterruptedException {
  this.conf = new JobConf();
  this.conf.setInt(HFSPScheduler.TRAINER_MIN_MAPS_KEYNAME, 0);
  this.conf.setInt(CompletedTasksTrainer.NUM_MAP_COMPLETED_KEY, 1);
  this.conf.setInt(HFSPScheduler.TRAINER_MIN_REDUCES_KEYNAME, 0);
  this.conf.setInt(SojournTrainer.getSojournConfKeyname(
      HFSPScheduler.PREFIX_KEYNAME, TaskType.REDUCE), 1);

  this.conf.set("mapred.job.tracker", "localhost:0");
  this.conf.set("mapred.job.tracker.http.address", "0.0.0.0:0");

  this.taskTrackerManager = new HFSPFakeTaskTrackerManager(numRacks,
      numNodesPerRack);
  this.clock = new FakeClock();
  try {
    this.jobTracker = new JobTracker(this.conf, this.clock);
  } catch (Exception e) {
    throw new RuntimeException("Could not start JT", e);
  }
  this.scheduler = new HFSPScheduler(clock, true);
  this.scheduler.setConf(conf);
  this.scheduler.setTaskTrackerManager(taskTrackerManager);
  this.scheduler.start();
  this.advanceTime(100);
}
 
开发者ID:melrief,项目名称:HFSP,代码行数:29,代码来源:TestHFSP.java


示例12: setUp

import org.apache.hadoop.mapred.UtilsForTests.FakeClock; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
  JobConf conf = new JobConf();
  conf.set(JTConfig.JT_IPC_ADDRESS, "localhost:0");
  conf.set(JTConfig.JT_HTTP_ADDRESS, "0.0.0.0:0");
  conf.setLong(JTConfig.JT_TRACKER_EXPIRY_INTERVAL, 1000);
  clock = new FakeClock();
  // We use a "partial mock" of JobTracker which lets us see when certain
  // methods are called. If we were writing JobTracker from scratch then
  // we would make it call another object which we would mock out instead
  // (and use a real JobTracker) so we could perform assertions on the mock.
  // See http://mockito.googlecode.com/svn/branches/1.8.0/javadoc/org/mockito/Mockito.html#16
  jobTracker = spy(new JobTracker(conf, clock));
}
 
开发者ID:rekhajoshm,项目名称:mapreduce-fork,代码行数:15,代码来源:TestLostTaskTracker.java


示例13: testJobTrackerStartConfig

import org.apache.hadoop.mapred.UtilsForTests.FakeClock; //导入依赖的package包/类
public void testJobTrackerStartConfig() throws Exception {
  JobConf conf = new JobConf();
  conf = MiniMRCluster.configureJobConf(conf, "file:///", 0, 0, null);
  
  // test JobTracker's default clock
  Clock c = JobTracker.getClock();
  assertNotNull(c);
  assertEquals(c, JobTracker.DEFAULT_CLOCK);
  
  // test with default values
  JobTracker jt = JobTracker.startTracker(conf);
  c = JobTracker.getClock();
  // test clock
  assertNotNull(c);
  assertEquals(c, JobTracker.DEFAULT_CLOCK);
  // test identifier
  assertEquals(12, jt.getTrackerIdentifier().length()); // correct upto mins
  jt.stopTracker();
  
  // test with special clock
  FakeClock myClock = new FakeClock();
  jt = JobTracker.startTracker(conf, myClock);
  c = JobTracker.getClock();
  assertNotNull(c);
  assertEquals(c, myClock);
  jt.stopTracker();
  
  // test with special identifier
  String identifier = "test-identifier";
  jt = JobTracker.startTracker(conf, JobTracker.DEFAULT_CLOCK, identifier);
  assertEquals(identifier, jt.getTrackerIdentifier());
  jt.stopTracker();
}
 
开发者ID:rekhajoshm,项目名称:mapreduce-fork,代码行数:34,代码来源:TestJobTrackerStart.java


示例14: setUp

import org.apache.hadoop.mapred.UtilsForTests.FakeClock; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
  JobConf conf = new JobConf();
  conf.set(JTConfig.JT_IPC_ADDRESS, "localhost:0");
  conf.set(JTConfig.JT_HTTP_ADDRESS, "0.0.0.0:0");
  conf.setLong(JTConfig.JT_TRACKER_EXPIRY_INTERVAL, 1000);
  conf.set(JTConfig.JT_MAX_TRACKER_BLACKLISTS, "1");
  jobTracker = new FakeJobTracker(conf, (clock = new FakeClock()), trackers);
  jobTracker.startExpireTrackersThread();
}
 
开发者ID:rekhajoshm,项目名称:mapreduce-fork,代码行数:11,代码来源:TestLostTracker.java


示例15: setUp

import org.apache.hadoop.mapred.UtilsForTests.FakeClock; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
  JobConf conf = new JobConf();
  conf.set(JTConfig.JT_IPC_ADDRESS, "localhost:0");
  conf.set(JTConfig.JT_HTTP_ADDRESS, "0.0.0.0:0");
  conf.setLong(JTConfig.JT_TRACKER_EXPIRY_INTERVAL, 1000);
  jobTracker = new FakeJobTracker(conf, (clock = new FakeClock()), trackers);
}
 
开发者ID:rekhajoshm,项目名称:mapreduce-fork,代码行数:9,代码来源:TestKillCompletedJob.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java MutableValueInt类代码示例发布时间:2022-05-23
下一篇:
Java PersistenceAdapter类代码示例发布时间: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