Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ch.fhnw.ddm.myMiniMapRed;
- //== MinimalMapReduce: The simplest possible MapReduce driver, which uses the defaults
- import org.apache.hadoop.conf.Configured;
- import org.apache.hadoop.util.Tool;
- import org.apache.hadoop.util.ToolRunner;
- import org.apache.hadoop.mapreduce.Job;
- import org.apache.hadoop.fs.Path;
- import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
- import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
- public class MinimalMapReduce extends Configured implements Tool {
- @Override
- public int run(String[] args) throws Exception {
- if (args.length != 2) {
- System.err.printf("Usage: %s [generic options] <in> <out>\n", getClass().getSimpleName());
- ToolRunner.printGenericCommandUsage(System.err);
- return -1;
- }
- Job job = Job.getInstance(getConf(), "minimapred");
- job.setJarByClass(this.getClass());
- FileInputFormat.addInputPath(job, new Path(args[0]));
- FileOutputFormat.setOutputPath(job, new Path(args[1]));
- return job.waitForCompletion(true) ? 0 : 1;
- }
- public static void main(String[] args) throws Exception {
- int res = ToolRunner.run(new MinimalMapReduce(), args);
- System.exit(res);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement