我正在尝试检查Mapreduce作业的jobstatus。

当我运行job.iscomplete()时,出现异常"Job in state DEFINE instead of RUNNING"

try {
                    if (job.isComplete()) {
                        printInfoLog(LOG, this.filename,
                                "** " + job.getTrackingURL());
                        break;
                    }
                } catch (Exception e) {
                    LOG.warn("** " + e.getMessage());

                }

但是没有这样的状态,因为我检查了Jobstatus(https://hadoop.apache.org/docs/stable/api/org/apache/hadoop/mapreduce/JobStatus.html)中的所有字段

我对这份工作尚未提交感到很了解。任何人都可以建议我如何检查作业是否已提交,因为在API中找不到任何这样的方法。

最佳答案

我解决了如下问题

if ( job.getJobState() == JobStatus.State.RUNNING || job.getJobState() == JobStatus.State.SUCCEEDED || job.getJobState() == JobStatus.State.KILLED || job.getJobState() == JobStatus.State.FAILED)
{
try {
        if (job.isComplete()) {
        printInfoLog(LOG, this.filename,
                            "** " + job.getTrackingURL());
         break;
                    }
                } catch (Exception e) {
                    LOG.warn("** " + e.getMessage());

                }
}
}

虽然我同意它的粗略解决方案

10-08 14:29