// Path: src/main/java/com/dsinpractice/samples/hadoop/mapred/wordcount/WCReducer.java
// public class WCReducer extends Reducer<Text, IntWritable, Text, IntWritable> {
// 
//     @Override
//     public void reduce(Text word, Iterable<IntWritable> counts, Context context)
//             throws IOException, InterruptedException {
//         int wordCount = 0;
//         for (IntWritable count : counts) {
//             wordCount += count.get();
//         }
//         context.write(word, new IntWritable(wordCount));
//     }
// }


import com.dsinpractice.samples.hadoop.mapred.wordcount.WCReducer;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;
package com.dsinpractice.samples.hadoop.mapred.failures;


public class StragglerJob extends Configured implements Tool {
    @Override
    public int run(String[] args) throws Exception {
        Configuration conf = getConf();

        Job stragglerJob = new Job(conf, "StragglerJob");
        stragglerJob.setJarByClass(StragglerJob.class);

        FileInputFormat.addInputPath(stragglerJob, new Path(args[0]));
        stragglerJob.setMapperClass(StragglerMapper.class);
        stragglerJob.setSpeculativeExecution(true);

        FileOutputFormat.setOutputPath(stragglerJob, new Path(args[1]));
// Path: src/main/java/com/dsinpractice/samples/hadoop/mapred/wordcount/WCReducer.java
// public class WCReducer extends Reducer<Text, IntWritable, Text, IntWritable> {
// 
//     @Override
//     public void reduce(Text word, Iterable<IntWritable> counts, Context context)
//             throws IOException, InterruptedException {
//         int wordCount = 0;
//         for (IntWritable count : counts) {
//             wordCount += count.get();
//         }
//         context.write(word, new IntWritable(wordCount));
//     }
// }


// Path: src/main/java/com/dsinpractice/samples/hadoop/mapred/failures/StragglerJob.java
import com.dsinpractice.samples.hadoop.mapred.wordcount.WCReducer;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;

package com.dsinpractice.samples.hadoop.mapred.failures;


public class StragglerJob extends Configured implements Tool {
    @Override
    public int run(String[] args) throws Exception {
        Configuration conf = getConf();

        Job stragglerJob = new Job(conf, "StragglerJob");
        stragglerJob.setJarByClass(StragglerJob.class);

        FileInputFormat.addInputPath(stragglerJob, new Path(args[0]));
        stragglerJob.setMapperClass(StragglerMapper.class);
        stragglerJob.setSpeculativeExecution(true);

        FileOutputFormat.setOutputPath(stragglerJob, new Path(args[1]));
        stragglerJob.setReducerClass(WCReducer.class);