Advertisement
Guest User

Untitled

a guest
May 24th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. package ch.fhnw.ddm.myMiniMapRed;
  2.  
  3. //== MinimalMapReduce: The simplest possible MapReduce driver, which uses the defaults
  4.  
  5. import org.apache.hadoop.conf.Configured;
  6. import org.apache.hadoop.util.Tool;
  7. import org.apache.hadoop.util.ToolRunner;
  8. import org.apache.hadoop.mapreduce.Job;
  9. import org.apache.hadoop.fs.Path;
  10. import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
  11. import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
  12.  
  13. public class MinimalMapReduce extends Configured implements Tool {
  14.  
  15. @Override
  16. public int run(String[] args) throws Exception {
  17. if (args.length != 2) {
  18. System.err.printf("Usage: %s [generic options] <in> <out>\n", getClass().getSimpleName());
  19. ToolRunner.printGenericCommandUsage(System.err);
  20. return -1;
  21.  
  22. }
  23. Job job = Job.getInstance(getConf(), "minimapred");
  24. job.setJarByClass(this.getClass());
  25.  
  26. FileInputFormat.addInputPath(job, new Path(args[0]));
  27. FileOutputFormat.setOutputPath(job, new Path(args[1]));
  28. return job.waitForCompletion(true) ? 0 : 1;
  29. }
  30.  
  31. public static void main(String[] args) throws Exception {
  32. int res = ToolRunner.run(new MinimalMapReduce(), args);
  33. System.exit(res);
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement