Java 类org.apache.hadoop.mapred.DefaultTaskController 实例源码

项目:hadoop-2.6.0-cdh5.4.3    文件:UserLogManager.java   
/**
 * Create the user log manager to manage user logs on {@link TaskTracker}.
 * This constructor is there mainly for unit tests.
 * 
 * @param conf The {@link Configuration}
 *
 * @throws IOException
 */
public UserLogManager(Configuration conf) throws IOException {
  Class<? extends TaskController> taskControllerClass = 
    conf.getClass("mapred.task.tracker.task-controller", 
                   DefaultTaskController.class, TaskController.class);
  TaskController taskController = 
   (TaskController) ReflectionUtils.newInstance(taskControllerClass, conf);
  this.taskController = taskController;
  setFields(conf);
}
项目:hadoop-on-lustre    文件:UserLogManager.java   
/**
 * Create the user log manager to manage user logs on {@link TaskTracker}.
 * This constructor is there mainly for unit tests.
 * 
 * @param conf The {@link Configuration}
 *
 * @throws IOException
 */
public UserLogManager(Configuration conf) throws IOException {
  Class<? extends TaskController> taskControllerClass = 
    conf.getClass("mapred.task.tracker.task-controller", 
                   DefaultTaskController.class, TaskController.class);
  TaskController taskController = 
   (TaskController) ReflectionUtils.newInstance(taskControllerClass, conf);
  this.taskController = taskController;
  setFields(conf);
}
项目:hanoi-hadoop-2.0.0-cdh    文件:UserLogManager.java   
/**
 * Create the user log manager to manage user logs on {@link TaskTracker}.
 * This constructor is there mainly for unit tests.
 * 
 * @param conf The {@link Configuration}
 *
 * @throws IOException
 */
public UserLogManager(Configuration conf) throws IOException {
  Class<? extends TaskController> taskControllerClass = 
    conf.getClass("mapred.task.tracker.task-controller", 
                   DefaultTaskController.class, TaskController.class);
  TaskController taskController = 
   (TaskController) ReflectionUtils.newInstance(taskControllerClass, conf);
  this.taskController = taskController;
  setFields(conf);
}
项目:hortonworks-extension    文件:UserLogManager.java   
/**
 * Create the user log manager to manage user logs on {@link TaskTracker}.
 * This constructor is there mainly for unit tests.
 * 
 * @param conf The {@link Configuration}
 *
 * @throws IOException
 */
public UserLogManager(Configuration conf) throws IOException {
  Class<? extends TaskController> taskControllerClass = 
    conf.getClass("mapred.task.tracker.task-controller", 
                   DefaultTaskController.class, TaskController.class);
  TaskController taskController = 
   (TaskController) ReflectionUtils.newInstance(taskControllerClass, conf);
  this.taskController = taskController;
  setFields(conf);
}
项目:hortonworks-extension    文件:UserLogManager.java   
/**
 * Create the user log manager to manage user logs on {@link TaskTracker}.
 * This constructor is there mainly for unit tests.
 * 
 * @param conf The {@link Configuration}
 *
 * @throws IOException
 */
public UserLogManager(Configuration conf) throws IOException {
  Class<? extends TaskController> taskControllerClass = 
    conf.getClass("mapred.task.tracker.task-controller", 
                   DefaultTaskController.class, TaskController.class);
  TaskController taskController = 
   (TaskController) ReflectionUtils.newInstance(taskControllerClass, conf);
  this.taskController = taskController;
  setFields(conf);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestTrackerDistributedCacheManager.java   
@Override
protected void setUp() throws IOException,InterruptedException {

  // Prepare the tests' root dir
  File TEST_ROOT = new File(TEST_ROOT_DIR);
  if (!TEST_ROOT.exists()) {
    TEST_ROOT.mkdirs();
  }

  conf = new Configuration();
  conf.set(FileSystem.FS_DEFAULT_NAME_KEY, "file:///");
  fs = FileSystem.get(conf);

  // This test suite will fail if any ancestor directory of the
  // test directory is not world-searchable (ie +x).
  // We prefer to fail the test in an obvious manner up front
  // during setUp() rather than in a subtle way later.
  assertTrue("Test root directory " + TEST_ROOT + " and all of its " +
             "parent directories must have a+x permissions",
             TrackerDistributedCacheManager.ancestorsHaveExecutePermissions(
               fs, new Path(TEST_ROOT.toString()), new HashMap<URI, FileStatus>()));

  // Prepare the tests' mapred-local-dir
  ROOT_MAPRED_LOCAL_DIR = new File(TEST_ROOT_DIR, "mapred/local");
  ROOT_MAPRED_LOCAL_DIR.mkdirs();

  String []localDirs = new String[numLocalDirs];
  for (int i = 0; i < numLocalDirs; i++) {
    File localDir = new File(ROOT_MAPRED_LOCAL_DIR, "0_" + i);
    localDirs[i] = localDir.getPath();
    localDir.mkdir();
  }

  conf.setStrings("mapred.local.dir", localDirs);
  Class<? extends TaskController> taskControllerClass = conf.getClass(
      "mapred.task.tracker.task-controller", DefaultTaskController.class,
      TaskController.class);
  taskController = (TaskController) ReflectionUtils.newInstance(
      taskControllerClass, conf);

  // setup permissions for mapred local dir
  UtilsForTests.setupTC(taskController, localDirAllocator,
      conf.getStrings(JobConf.MAPRED_LOCAL_DIR_PROPERTY));

  // Create the temporary cache files to be used in the tests.
  firstCacheFile = new Path(TEST_ROOT_DIR, "firstcachefile");
  secondCacheFile = new Path(TEST_ROOT_DIR, "secondcachefile");
  firstCacheFilePublic = new Path(TEST_ROOT_DIR, "firstcachefileOne");
  secondCacheFilePublic = new Path(TEST_ROOT_DIR, "secondcachefileOne");
  createPublicTempFile(firstCacheFilePublic);
  createPublicTempFile(secondCacheFilePublic);
  createPrivateTempFile(firstCacheFile);
  createPrivateTempFile(secondCacheFile);

  firstCacheDirPublic = new Path(TEST_ROOT_DIR, "firstcachedirPublic");
  firstCacheDirPrivate = new Path(TEST_ROOT_DIR, "firstcachedirPrivate");
  firstCacheFileInDirPublic = new Path(firstCacheDirPublic, "firstcacheFileinDirPublic.txt");
  firstCacheFileInDirPrivate = new Path(firstCacheDirPrivate, "firstcacheFileinDirPrivate.txt");
  createPublicTempDir(firstCacheDirPublic);
  createPrivateTempDir(firstCacheDirPrivate);
  createPublicTempFile(firstCacheFileInDirPublic);
  createPrivateTempFile(firstCacheFileInDirPrivate);
}
项目:hadoop-on-lustre    文件:TestTrackerDistributedCacheManager.java   
@Override
protected void setUp() throws IOException,InterruptedException {

  // Prepare the tests' root dir
  File TEST_ROOT = new File(TEST_ROOT_DIR);
  if (!TEST_ROOT.exists()) {
    TEST_ROOT.mkdirs();
  }

  // Prepare the tests' mapred-local-dir
  ROOT_MAPRED_LOCAL_DIR = new File(TEST_ROOT_DIR, "mapred/local");
  ROOT_MAPRED_LOCAL_DIR.mkdirs();

  String []localDirs = new String[numLocalDirs];
  for (int i = 0; i < numLocalDirs; i++) {
    File localDir = new File(ROOT_MAPRED_LOCAL_DIR, "0_" + i);
    localDirs[i] = localDir.getPath();
    localDir.mkdir();
  }

  conf = new Configuration();
  conf.setStrings("mapred.local.dir", localDirs);
  conf.set(FileSystem.FS_DEFAULT_NAME_KEY, "file:///");
  fs = FileSystem.get(conf);
  Class<? extends TaskController> taskControllerClass = conf.getClass(
      "mapred.task.tracker.task-controller", DefaultTaskController.class,
      TaskController.class);
  taskController = (TaskController) ReflectionUtils.newInstance(
      taskControllerClass, conf);

  // setup permissions for mapred local dir
  UtilsForTests.setupTC(taskController, localDirAllocator,
      conf.getStrings(JobConf.MAPRED_LOCAL_DIR_PROPERTY));

  // Create the temporary cache files to be used in the tests.
  firstCacheFile = new Path(TEST_ROOT_DIR, "firstcachefile");
  secondCacheFile = new Path(TEST_ROOT_DIR, "secondcachefile");
  firstCacheFilePublic = new Path(TEST_ROOT_DIR, "firstcachefileOne");
  secondCacheFilePublic = new Path(TEST_ROOT_DIR, "secondcachefileOne");
  createPublicTempFile(firstCacheFilePublic);
  createPublicTempFile(secondCacheFilePublic);
  createPrivateTempFile(firstCacheFile);
  createPrivateTempFile(secondCacheFile);

  firstCacheDirPublic = new Path(TEST_ROOT_DIR, "firstcachedirPublic");
  firstCacheDirPrivate = new Path(TEST_ROOT_DIR, "firstcachedirPrivate");
  firstCacheFileInDirPublic = new Path(firstCacheDirPublic, "firstcacheFileinDirPublic.txt");
  firstCacheFileInDirPrivate = new Path(firstCacheDirPrivate, "firstcacheFileinDirPrivate.txt");
  createPublicTempDir(firstCacheDirPublic);
  createPrivateTempDir(firstCacheDirPrivate);
  createPublicTempFile(firstCacheFileInDirPublic);
  createPrivateTempFile(firstCacheFileInDirPrivate);
}
项目:hanoi-hadoop-2.0.0-cdh    文件:TestTrackerDistributedCacheManager.java   
@Override
protected void setUp() throws IOException,InterruptedException {

  // Prepare the tests' root dir
  File TEST_ROOT = new File(TEST_ROOT_DIR);
  if (!TEST_ROOT.exists()) {
    TEST_ROOT.mkdirs();
  }

  conf = new Configuration();
  conf.set(FileSystem.FS_DEFAULT_NAME_KEY, "file:///");
  fs = FileSystem.get(conf);

  // This test suite will fail if any ancestor directory of the
  // test directory is not world-searchable (ie +x).
  // We prefer to fail the test in an obvious manner up front
  // during setUp() rather than in a subtle way later.
  assertTrue("Test root directory " + TEST_ROOT + " and all of its " +
             "parent directories must have a+x permissions",
             TrackerDistributedCacheManager.ancestorsHaveExecutePermissions(
               fs, new Path(TEST_ROOT.toString()), new HashMap<URI, FileStatus>()));

  // Prepare the tests' mapred-local-dir
  ROOT_MAPRED_LOCAL_DIR = new File(TEST_ROOT_DIR, "mapred/local");
  ROOT_MAPRED_LOCAL_DIR.mkdirs();

  String []localDirs = new String[numLocalDirs];
  for (int i = 0; i < numLocalDirs; i++) {
    File localDir = new File(ROOT_MAPRED_LOCAL_DIR, "0_" + i);
    localDirs[i] = localDir.getPath();
    localDir.mkdir();
  }

  conf.setStrings("mapred.local.dir", localDirs);
  Class<? extends TaskController> taskControllerClass = conf.getClass(
      "mapred.task.tracker.task-controller", DefaultTaskController.class,
      TaskController.class);
  taskController = (TaskController) ReflectionUtils.newInstance(
      taskControllerClass, conf);

  // setup permissions for mapred local dir
  UtilsForTests.setupTC(taskController, localDirAllocator,
      conf.getStrings(JobConf.MAPRED_LOCAL_DIR_PROPERTY));

  // Create the temporary cache files to be used in the tests.
  firstCacheFile = new Path(TEST_ROOT_DIR, "firstcachefile");
  secondCacheFile = new Path(TEST_ROOT_DIR, "secondcachefile");
  firstCacheFilePublic = new Path(TEST_ROOT_DIR, "firstcachefileOne");
  secondCacheFilePublic = new Path(TEST_ROOT_DIR, "secondcachefileOne");
  createPublicTempFile(firstCacheFilePublic);
  createPublicTempFile(secondCacheFilePublic);
  createPrivateTempFile(firstCacheFile);
  createPrivateTempFile(secondCacheFile);

  firstCacheDirPublic = new Path(TEST_ROOT_DIR, "firstcachedirPublic");
  firstCacheDirPrivate = new Path(TEST_ROOT_DIR, "firstcachedirPrivate");
  firstCacheFileInDirPublic = new Path(firstCacheDirPublic, "firstcacheFileinDirPublic.txt");
  firstCacheFileInDirPrivate = new Path(firstCacheDirPrivate, "firstcacheFileinDirPrivate.txt");
  createPublicTempDir(firstCacheDirPublic);
  createPrivateTempDir(firstCacheDirPrivate);
  createPublicTempFile(firstCacheFileInDirPublic);
  createPrivateTempFile(firstCacheFileInDirPrivate);
}
项目:mapreduce-fork    文件:TestTrackerDistributedCacheManager.java   
@Override
protected void setUp() throws IOException,InterruptedException {

  // Prepare the tests' root dir
  File TEST_ROOT = new File(TEST_ROOT_DIR);
  if (!TEST_ROOT.exists()) {
    TEST_ROOT.mkdirs();
  }

  conf = new Configuration();
  conf.set(FileSystem.FS_DEFAULT_NAME_KEY, "file:///");
  fs = FileSystem.get(conf);

  // This test suite will fail if any ancestor directory of the
  // test directory is not world-searchable (ie +x).
  // We prefer to fail the test in an obvious manner up front
  // during setUp() rather than in a subtle way later.
  assertTrue("Test root directory " + TEST_ROOT + " and all of its " +
             "parent directories must have a+x permissions",
             ClientDistributedCacheManager.ancestorsHaveExecutePermissions(
               fs, new Path(TEST_ROOT.toString())));

  // Prepare the tests' mapred-local-dir
  ROOT_MAPRED_LOCAL_DIR = new File(TEST_ROOT_DIR, "mapred/local");
  ROOT_MAPRED_LOCAL_DIR.mkdirs();

  String []localDirs = new String[numLocalDirs];
  for (int i = 0; i < numLocalDirs; i++) {
    File localDir = new File(ROOT_MAPRED_LOCAL_DIR, "0_" + i);
    localDirs[i] = localDir.getPath();
    localDir.mkdir();
  }

  conf.setStrings(MRConfig.LOCAL_DIR, localDirs);
  Class<? extends TaskController> taskControllerClass = conf.getClass(
      TTConfig.TT_TASK_CONTROLLER, DefaultTaskController.class,
      TaskController.class);
  taskController = (TaskController) ReflectionUtils.newInstance(
      taskControllerClass, conf);

  // setup permissions for mapred local dir
  taskController.setup();

  // Create the temporary cache files to be used in the tests.
  firstCacheFile = new Path(TEST_ROOT_DIR, "firstcachefile");
  secondCacheFile = new Path(TEST_ROOT_DIR, "secondcachefile");
  createPrivateTempFile(firstCacheFile);
  createPrivateTempFile(secondCacheFile);
}
项目:hortonworks-extension    文件:TestTrackerDistributedCacheManager.java   
@Override
protected void setUp() throws IOException,InterruptedException {

  // Prepare the tests' root dir
  File TEST_ROOT = new File(TEST_ROOT_DIR);
  if (!TEST_ROOT.exists()) {
    TEST_ROOT.mkdirs();
  }

  // Prepare the tests' mapred-local-dir
  ROOT_MAPRED_LOCAL_DIR = new File(TEST_ROOT_DIR, "mapred/local");
  ROOT_MAPRED_LOCAL_DIR.mkdirs();

  String []localDirs = new String[numLocalDirs];
  for (int i = 0; i < numLocalDirs; i++) {
    File localDir = new File(ROOT_MAPRED_LOCAL_DIR, "0_" + i);
    localDirs[i] = localDir.getPath();
    localDir.mkdir();
  }

  conf = new Configuration();
  conf.setStrings("mapred.local.dir", localDirs);
  conf.set(FileSystem.FS_DEFAULT_NAME_KEY, "file:///");
  fs = FileSystem.get(conf);
  Class<? extends TaskController> taskControllerClass = conf.getClass(
      "mapred.task.tracker.task-controller", DefaultTaskController.class,
      TaskController.class);
  taskController = (TaskController) ReflectionUtils.newInstance(
      taskControllerClass, conf);

  // setup permissions for mapred local dir
  UtilsForTests.setupTC(taskController, localDirAllocator,
      conf.getStrings(JobConf.MAPRED_LOCAL_DIR_PROPERTY));

  // Create the temporary cache files to be used in the tests.
  firstCacheFile = new Path(TEST_ROOT_DIR, "firstcachefile");
  secondCacheFile = new Path(TEST_ROOT_DIR, "secondcachefile");
  firstCacheFilePublic = new Path(TEST_ROOT_DIR, "firstcachefileOne");
  secondCacheFilePublic = new Path(TEST_ROOT_DIR, "secondcachefileOne");
  createPublicTempFile(firstCacheFilePublic);
  createPublicTempFile(secondCacheFilePublic);
  createPrivateTempFile(firstCacheFile);
  createPrivateTempFile(secondCacheFile);

  firstCacheDirPublic = new Path(TEST_ROOT_DIR, "firstcachedirPublic");
  firstCacheDirPrivate = new Path(TEST_ROOT_DIR, "firstcachedirPrivate");
  firstCacheFileInDirPublic = new Path(firstCacheDirPublic, "firstcacheFileinDirPublic.txt");
  firstCacheFileInDirPrivate = new Path(firstCacheDirPrivate, "firstcacheFileinDirPrivate.txt");
  createPublicTempDir(firstCacheDirPublic);
  createPrivateTempDir(firstCacheDirPrivate);
  createPublicTempFile(firstCacheFileInDirPublic);
  createPrivateTempFile(firstCacheFileInDirPrivate);
}
项目:hortonworks-extension    文件:TestTrackerDistributedCacheManager.java   
@Override
protected void setUp() throws IOException,InterruptedException {

  // Prepare the tests' root dir
  File TEST_ROOT = new File(TEST_ROOT_DIR);
  if (!TEST_ROOT.exists()) {
    TEST_ROOT.mkdirs();
  }

  // Prepare the tests' mapred-local-dir
  ROOT_MAPRED_LOCAL_DIR = new File(TEST_ROOT_DIR, "mapred/local");
  ROOT_MAPRED_LOCAL_DIR.mkdirs();

  String []localDirs = new String[numLocalDirs];
  for (int i = 0; i < numLocalDirs; i++) {
    File localDir = new File(ROOT_MAPRED_LOCAL_DIR, "0_" + i);
    localDirs[i] = localDir.getPath();
    localDir.mkdir();
  }

  conf = new Configuration();
  conf.setStrings("mapred.local.dir", localDirs);
  conf.set(FileSystem.FS_DEFAULT_NAME_KEY, "file:///");
  fs = FileSystem.get(conf);
  Class<? extends TaskController> taskControllerClass = conf.getClass(
      "mapred.task.tracker.task-controller", DefaultTaskController.class,
      TaskController.class);
  taskController = (TaskController) ReflectionUtils.newInstance(
      taskControllerClass, conf);

  // setup permissions for mapred local dir
  UtilsForTests.setupTC(taskController, localDirAllocator,
      conf.getStrings(JobConf.MAPRED_LOCAL_DIR_PROPERTY));

  // Create the temporary cache files to be used in the tests.
  firstCacheFile = new Path(TEST_ROOT_DIR, "firstcachefile");
  secondCacheFile = new Path(TEST_ROOT_DIR, "secondcachefile");
  firstCacheFilePublic = new Path(TEST_ROOT_DIR, "firstcachefileOne");
  secondCacheFilePublic = new Path(TEST_ROOT_DIR, "secondcachefileOne");
  createPublicTempFile(firstCacheFilePublic);
  createPublicTempFile(secondCacheFilePublic);
  createPrivateTempFile(firstCacheFile);
  createPrivateTempFile(secondCacheFile);

  firstCacheDirPublic = new Path(TEST_ROOT_DIR, "firstcachedirPublic");
  firstCacheDirPrivate = new Path(TEST_ROOT_DIR, "firstcachedirPrivate");
  firstCacheFileInDirPublic = new Path(firstCacheDirPublic, "firstcacheFileinDirPublic.txt");
  firstCacheFileInDirPrivate = new Path(firstCacheDirPrivate, "firstcacheFileinDirPrivate.txt");
  createPublicTempDir(firstCacheDirPublic);
  createPrivateTempDir(firstCacheDirPrivate);
  createPublicTempFile(firstCacheFileInDirPublic);
  createPrivateTempFile(firstCacheFileInDirPrivate);
}