如何从Java关闭hadoop推测性执行
阅读之后,我试图使用新的JavaAPI关闭推测性执行,但没有效果 这是我的主要课程:如何从Java关闭hadoop推测性执行,java,hadoop,elastic-map-reduce,speculative-execution,Java,Hadoop,Elastic Map Reduce,Speculative Execution,阅读之后,我试图使用新的JavaAPI关闭推测性执行,但没有效果 这是我的主要课程: public class Main { public static void main(String[] args) throws Exception { Configuration conf = new Configuration(); //old api: //conf.setBoolean("mapred.map.tasks.speculative.execution",
public class Main {
public static void main(String[] args) throws Exception {
Configuration conf = new Configuration();
//old api:
//conf.setBoolean("mapred.map.tasks.speculative.execution", false);
//new api:
conf.setBoolean("mapreduce.map.speculative", false);
int res = ToolRunner.run(conf, new LogParserMapReduce(), args);
System.exit(res);
}
}
我的MapReducer是这样开始的:
@Override
public int run(String[] args) throws Exception {
Configuration conf = super.getConf();
/*
* Instantiate a Job object for your job's configuration.
*/
Job job = Job.getInstance(conf);
但当我查看日志时,我看到:
2014-04-24 10:06:21,418 INFO org.apache.hadoop.mapreduce.lib.input.FileInputFormat (main): Total input paths to process : 16
2014-04-24 10:06:21,574 INFO org.apache.hadoop.mapreduce.JobSubmitter (main): number of splits:26
如果我理解的话,这意味着推测执行仍然在进行中,否则,如果我只有16个输入文件,为什么会有26个分割呢。我弄错了吗
注意:我相信我使用了新的api,因为我在日志中看到了以下警告:
2014-04-24 10:06:21,590 INFO org.apache.hadoop.conf.Configuration.deprecation (main): mapred.job.classpath.files is deprecated. Instead, use mapreduce.job.classpath.files
“16个文件=16个映射器”这是一个错误的假设
“16个文件=最少16个映射器”这是正确的
如果16个文件中的某些文件大于块大小,则会将其拆分为多个贴图器。因此,生成26个映射器的16个文件可能不是因为推测性执行
在Conf中设置值当然有效。您可以通过检查job.xml来验证设置“映射任务无推测性执行”是否正常。另一种设置it运行时(使实验/测试更容易)的方法是在命令行中传递相应的参数(-s)。因此,例如,下面将贴图的推测执行设置为“关闭”,但还原器的推测执行设置为“打开”:
bin/hadoop jar -Dmapreduce.map.speculative=false \
-Dmapreduce.reduce.speculative=true <jar>
bin/hadoop jar-Dmapreduce.map.思辨=false\
-Dmapreduce.reduce.Projective=true
的确如此。另一个线索:在我关闭推测执行之前,我通常会看到一些已终止的任务,但由于它已关闭,所以没有已终止的任务