有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java报告状态失败达600秒。谋杀!报告hadoop的进展

我收到以下错误:

Task attempt_201304161625_0028_m_000000_0 failed to report status for 600 seconds. Killing! 

我的地图工作。这个问题类似于thisthisthis。但是,我不想在hadoop终止不报告进度的任务之前增加默认时间,,即

Configuration conf=new Configuration();
long milliSeconds = 1000*60*60;
conf.setLong("mapred.task.timeout", milliSeconds);

相反,我想使用context.progress()context.setStatus("Some Message")context.getCounter(SOME_ENUM.PROGRESS).increment(1)或类似的方式定期报告进度。然而,这仍然会导致工作被终止。下面是我试图报告进度的代码片段。地图绘制者:

protected void map(Key key, Value value, Context context) throws IOException, InterruptedException {

    //do some things
    Optimiser optimiser = new Optimiser();
    optimiser.optimiseFurther(<some parameters>, context);
    //more things
    context.write(newKey, newValue);
}

Optimizer类中的Optimizer进一步方法:

public void optimiseFurther(<Some parameters>, TaskAttemptContext context) {

    int count = 0;
    while(something is true) {
        //optimise

        //try to report progress
        context.setStatus("Progressing:" + count);
        System.out.println("Optimise Progress:" + context.getStatus());
        context.progress();
        count++;
    }
}

映射器的输出显示状态正在更新:

Optimise Progress:Progressing:0
Optimise Progress:Progressing:1
Optimise Progress:Progressing:2
...

但是,在默认的时间量之后,作业仍然被终止。我是不是用错了上下文?为了成功报告进度,在作业设置中我还需要做什么


共 (1) 个答案

  1. # 1 楼答案

    这个问题与bug in Hadoop 0.20有关,因此对context.setStatus()context.progress()的调用不会报告给底层框架(设置各种计数器的调用也不起作用)。有一个补丁可用,所以更新到更新版本的Hadoop应该可以解决这个问题