Java Code Examples for org.apache.hadoop.mapreduce.tools.CLI

Following code examples demonstrate how to use org.apache.hadoop.mapreduce.tools.CLI from hadoop. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use org.apache.hadoop.mapreduce.tools.CLI and various code implementation of this class.
Example 1
Project : hadoop Source File : TestMRCJCJobClient.java View Source Code on GitHub

  public void testJobClient() throws Exception {
    Configuration conf = createJobConf();
    String jobId = runJob();
    testGetCounter(jobId, conf);
    testAllJobList(jobId, conf);
    testChangingJobPriority(jobId, conf);
  }
			
Example 2
Project : hadoop Source File : TestMRCJCJobClient.java View Source Code on GitHub

  private String runJob() throws Exception {
    OutputStream os = getFileSystem().create(new Path(getInputDir(),
                        "text.txt"));
    Writer wr = new OutputStreamWriter(os);
    wr.write("hello1\n");
    wr.write("hello2\n");
    wr.write("hello3\n");
    wr.close();

    JobConf conf = createJobConf();
    conf.setJobName("mr");
    conf.setJobPriority(JobPriority.HIGH);
    
    conf.setInputFormat(TextInputFormat.class);

    conf.setMapOutputKeyClass(LongWritable.class);
    conf.setMapOutputValueClass(Text.class);

    conf.setOutputFormat(TextOutputFormat.class);
    conf.setOutputKeyClass(LongWritable.class);
    conf.setOutputValueClass(Text.class);

    conf.setMapperClass(org.apache.hadoop.mapred.lib.IdentityMapper.class);
    conf.setReducerClass(org.apache.hadoop.mapred.lib.IdentityReducer.class);

    FileInputFormat.setInputPaths(conf, getInputDir());
    FileOutputFormat.setOutputPath(conf, getOutputDir());

    return JobClient.runJob(conf).getID().toString();
  }
			
Example 3
Project : hadoop Source File : TestJobClient.java View Source Code on GitHub

  public void testJobClient() throws Exception {
    Configuration conf = createJobConf();
    String jobId = runJob();
    testGetCounter(jobId, conf);
    testJobList(jobId, conf);
    testChangingJobPriority(jobId, conf);
  }
			
Example 4
Project : hadoop Source File : TestJobClient.java View Source Code on GitHub

  private String runJob() throws Exception {
    OutputStream os = getFileSystem().create(new Path(getInputDir(),
                        "text.txt"));
    Writer wr = new OutputStreamWriter(os);
    wr.write("hello1\n");
    wr.write("hello2\n");
    wr.write("hello3\n");
    wr.close();

    JobConf conf = createJobConf();
    conf.setJobName("mr");
    conf.setJobPriority(JobPriority.HIGH);
    
    conf.setInputFormat(TextInputFormat.class);

    conf.setMapOutputKeyClass(LongWritable.class);
    conf.setMapOutputValueClass(Text.class);

    conf.setOutputFormat(TextOutputFormat.class);
    conf.setOutputKeyClass(LongWritable.class);
    conf.setOutputValueClass(Text.class);

    conf.setMapperClass(org.apache.hadoop.mapred.lib.IdentityMapper.class);
    conf.setReducerClass(org.apache.hadoop.mapred.lib.IdentityReducer.class);

    FileInputFormat.setInputPaths(conf, getInputDir());
    FileOutputFormat.setOutputPath(conf, getOutputDir());

    return JobClient.runJob(conf).getID().toString();
  }