我无法将“job.setNumMapTasks(int)”添加到我的 MapReduce 程序的驱动程序中。当我尝试添加它时,我收到一个编译错误,指出“setNumMapTasks(int) 未定义作业类型”。但是,我可以添加等效的减速器“job.setNumReduceTasks(int)”。在我看来,如果我可以添加一个,我应该能够添加另一个。下面是我的司机。任何建议都非常受欢迎。
public int run(String[] args) throws Exception {
Configuration conf = getConf();
Job job = new Job(conf, "PiCalc");
job.setJarByClass(PiCalc.class);
Path in = new Path(args[0]);
Path out = new Path(args[1]);
FileInputFormat.setInputPaths(job, in);
FileOutputFormat.setOutputPath(job, out);
job.setJobName("PiCalc");
job.setNumMapTasks(20);
job.setNumReduceTasks(10);
job.setMapperClass(MapClass.class);
job.setReducerClass(Reduce.class);
job.setInputFormatClass(KeyValueTextInputFormat.class);
job.setOutputFormatClass(TextOutputFormat.class);
job.setOutputKeyClass(IntWritable.class);
job.setOutputValueClass(IntWritable.class);
System.exit(job.waitForCompletion(true)?0:1);
return 0;
}