Java Code Examples for org.apache.hadoop.conf.Configuration.setEnum()

The following are Jave code examples for showing how to use setEnum() of the org.apache.hadoop.conf.Configuration class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: hadoop-oss   File: ZlibFactory.java   View Source Code Vote up 4 votes
public static void setCompressionStrategy(Configuration conf,
    CompressionStrategy strategy) {
  conf.setEnum("zlib.compress.strategy", strategy);
}
 
Example 2
Project: hadoop-oss   File: ZlibFactory.java   View Source Code Vote up 4 votes
public static void setCompressionLevel(Configuration conf,
    CompressionLevel level) {
  conf.setEnum("zlib.compress.level", level);
}
 
Example 3
Project: hadoop   File: CommonJobTest.java   View Source Code Vote up 4 votes
protected void doSubmission(String jobCreatorName, boolean defaultOutputPath)
        throws Exception {
  final Path in = new Path("foo").makeQualified(
          GridmixTestUtils.dfs.getUri(),
          GridmixTestUtils.dfs.getWorkingDirectory());
  final Path out = GridmixTestUtils.DEST.makeQualified(
          GridmixTestUtils.dfs.getUri(),
          GridmixTestUtils.dfs.getWorkingDirectory());
  final Path root = new Path(workspace.getName()).makeQualified(
      GridmixTestUtils.dfs.getUri(), GridmixTestUtils.dfs.getWorkingDirectory());
  if (!workspace.exists()) {
    assertTrue(workspace.mkdirs());
  }
  Configuration conf = null;

  try {
    ArrayList<String> argsList = new ArrayList<String>();

    argsList.add("-D" + FilePool.GRIDMIX_MIN_FILE + "=0");
    argsList.add("-D" + Gridmix.GRIDMIX_USR_RSV + "="
            + EchoUserResolver.class.getName());
    if (jobCreatorName != null) {
      argsList.add("-D" + JobCreator.GRIDMIX_JOB_TYPE + "=" + jobCreatorName);
    }

    // Set the config property gridmix.output.directory only if
    // defaultOutputPath is false. If defaultOutputPath is true, then
    // let us allow gridmix to use the path foo/gridmix/ as output dir.
    if (!defaultOutputPath) {
      argsList.add("-D" + Gridmix.GRIDMIX_OUT_DIR + "=" + out);
    }
    argsList.add("-generate");
    argsList.add(String.valueOf(GENDATA) + "m");
    argsList.add(in.toString());
    argsList.add("-"); // ignored by DebugGridmix

    String[] argv = argsList.toArray(new String[argsList.size()]);

    DebugGridmix client = new DebugGridmix();
    conf = GridmixTestUtils.mrvl.getConfig();

    CompressionEmulationUtil.setCompressionEmulationEnabled(conf, true);
    conf.setEnum(GridmixJobSubmissionPolicy.JOB_SUBMISSION_POLICY, policy);

    conf.setBoolean(GridmixJob.GRIDMIX_USE_QUEUE_IN_TRACE, true);
    UserGroupInformation ugi = UserGroupInformation.getLoginUser();
    conf.set(MRJobConfig.USER_NAME, ugi.getUserName());

    // allow synthetic users to create home directories
    GridmixTestUtils.dfs.mkdirs(root, new FsPermission((short) 777));
    GridmixTestUtils.dfs.setPermission(root, new FsPermission((short) 777));

    int res = ToolRunner.run(conf, client, argv);
    assertEquals("Client exited with nonzero status", 0, res);
    client.checkMonitor();
  } catch (Exception e) {
    e.printStackTrace();
  } finally {
    in.getFileSystem(conf).delete(in, true);
    out.getFileSystem(conf).delete(out, true);
    root.getFileSystem(conf).delete(root, true);
  }
}
 
Example 4
Project: hadoop   File: ZlibFactory.java   View Source Code Vote up 4 votes
public static void setCompressionStrategy(Configuration conf,
    CompressionStrategy strategy) {
  conf.setEnum("zlib.compress.strategy", strategy);
}
 
Example 5
Project: hadoop   File: ZlibFactory.java   View Source Code Vote up 4 votes
public static void setCompressionLevel(Configuration conf,
    CompressionLevel level) {
  conf.setEnum("zlib.compress.level", level);
}