• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java TTTaskInfo类的典型用法和代码示例

java 3次浏览

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

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

示例1: testFilePermission

点赞 2

import org.apache.hadoop.mapreduce.test.system.TTTaskInfo; //导入依赖的package包/类
@Test
public void testFilePermission() throws Exception {
  wovenClient = cluster.getJTClient().getProxy();
  Configuration conf = new Configuration(cluster.getConf());
  FinishTaskControlAction.configureControlActionForJob(conf);
  SleepJob job = new SleepJob();
  job.setConf(conf);
  conf = job.setupJobConf(1, 0, 100, 100, 100, 100);
  JobConf jconf = new JobConf(conf);
  RunningJob rJob = cluster.getJTClient().getClient().submitJob(jconf);
  taskController = conf.get("mapred.task.tracker.task-controller");
  // get the job info so we can get the env variables from the daemon.
  // Now wait for the task to be in the running state, only then the
  // directories will be created
  JobInfo info = wovenClient.getJobInfo(rJob.getID());
  Assert.assertNotNull("JobInfo is null",info);
  JobID id = rJob.getID();
  while (info.runningMaps() != 1) {
    Thread.sleep(1000);
    info = wovenClient.getJobInfo(id);
  }
  TaskInfo[] myTaskInfos = wovenClient.getTaskInfo(id);
  for (TaskInfo tInfo : myTaskInfos) {
    if (!tInfo.isSetupOrCleanup()) {
      String[] taskTrackers = tInfo.getTaskTrackers();
      for (String taskTracker : taskTrackers) {
        TTInfo ttInfo = wovenClient.getTTInfo(taskTracker);
        TTClient ttCli = cluster.getTTClient(ttInfo.getStatus().getHost());
        Assert.assertNotNull("TTClient instance is null",ttCli);
        TTTaskInfo ttTaskInfo = ttCli.getProxy().getTask(tInfo.getTaskID());
        Assert.assertNotNull("TTTaskInfo is null",ttTaskInfo);
        while (ttTaskInfo.getTaskStatus().getRunState() !=
               TaskStatus.State.RUNNING) {
          Thread.sleep(100);
          ttTaskInfo = ttCli.getProxy().getTask(tInfo.getTaskID());
        }
        testPermissionWithTaskController(ttCli, conf, info);
        FinishTaskControlAction action = new FinishTaskControlAction(TaskID
            .downgrade(tInfo.getTaskID()));
        for (TTClient cli : cluster.getTTClients()) {
          cli.getProxy().sendAction(action);
        }
      }
    }
  }
  JobInfo jInfo = wovenClient.getJobInfo(id);
  jInfo = cluster.getJTClient().getProxy().getJobInfo(id);
  while (!jInfo.getStatus().isJobComplete()) {
    Thread.sleep(100);
    jInfo = cluster.getJTClient().getProxy().getJobInfo(id);
  }
}
 

开发者ID:Nextzero,
项目名称:hadoop-2.6.0-cdh5.4.3,
代码行数:53,
代码来源:TestFileOwner.java

示例2: testFilePermission

点赞 2

import org.apache.hadoop.mapreduce.test.system.TTTaskInfo; //导入依赖的package包/类
@Test
public void testFilePermission() throws Exception {
  wovenClient = cluster.getJTClient().getProxy();
  Configuration conf = new Configuration(cluster.getConf());
  FinishTaskControlAction.configureControlActionForJob(conf);
  SleepJob job = new SleepJob();
  job.setConf(conf);
  Job slpJob = job.createJob(1, 0, 100, 100, 100, 100);
  JobConf jconf = new JobConf(conf);
  slpJob.submit();
  RunningJob rJob =
      cluster.getJTClient().getClient().getJob(
          org.apache.hadoop.mapred.JobID.downgrade(slpJob.getJobID()));
  taskController = conf.get(TTConfig.TT_TASK_CONTROLLER);
  // get the job info so we can get the env variables from the daemon.
  // Now wait for the task to be in the running state, only then the
  // directories will be created
  JobInfo info = wovenClient.getJobInfo(rJob.getID());
  Assert.assertNotNull("JobInfo is null", info);
  JobID id = rJob.getID();
  while (info.runningMaps() != 1) {
    Thread.sleep(1000);
    info = wovenClient.getJobInfo(id);
  }
  TaskInfo[] myTaskInfos = wovenClient.getTaskInfo(id);
  for (TaskInfo tInfo : myTaskInfos) {
    if (!tInfo.isSetupOrCleanup()) {
      String[] taskTrackers = tInfo.getTaskTrackers();
      for (String taskTracker : taskTrackers) {
        TTInfo ttInfo = wovenClient.getTTInfo(taskTracker);
        TTClient ttCli = cluster.getTTClient(ttInfo.getStatus().getHost());
        Assert.assertNotNull("TTClient instance is null", ttCli);
        TTTaskInfo ttTaskInfo = ttCli.getProxy().getTask(tInfo.getTaskID());
        Assert.assertNotNull("TTTaskInfo is null", ttTaskInfo);
        while (ttTaskInfo.getTaskStatus().getRunState() != TaskStatus.State.RUNNING) {
          Thread.sleep(100);
          ttTaskInfo = ttCli.getProxy().getTask(tInfo.getTaskID());
        }
        testPermissionWithTaskController(ttCli, conf, info);
        FinishTaskControlAction action =
            new FinishTaskControlAction(TaskID.downgrade(tInfo.getTaskID()));
        for (TTClient cli : cluster.getTTClients()) {
          cli.getProxy().sendAction(action);
        }
      }
    }
  }
  JobInfo jInfo = wovenClient.getJobInfo(id);
  jInfo = cluster.getJTClient().getProxy().getJobInfo(id);
  while (!jInfo.getStatus().isJobComplete()) {
    Thread.sleep(100);
    jInfo = cluster.getJTClient().getProxy().getJobInfo(id);
  }
}
 

开发者ID:rekhajoshm,
项目名称:mapreduce-fork,
代码行数:55,
代码来源:TestFileOwner.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)