0

I'm using CDH4 with MRv1. From what I can tell, there is no command line tool for checking the "status" of a completed job. When I go to the web console job detail page, I can see "Status: Failed" or "Status: Succeeded". If I run mapred job -list all or mapred job -status job_201309231203_0011, neither indicate "Failed" or "Succeeded".

Am I missing some other command?

4

3 回答 3

5

输出的前几行hadoop job -list all是:

X jobs submitted
States are:
        Running : 1     Succeded : 2    Failed : 3      Prep : 4
JobId   State   StartTime       UserName        Priority        SchedulingInfo

输出的行看起来像:

job_201309171413_38136  1       1382455374980   somebody        NORMAL  0 running map tasks using 0 map slots. 0 additional slots reserved. 1 running reduce tasks using 1 reduce slots. 0 additional slots reserved.
job_201309171413_37222  2       1382430339635   somebody        NORMAL  0 running map tasks using 0 map slots. 0 additional slots reserved. 0 running reduce tasks using 0 reduce slots. 0 additional slots reserved.

第二列是State工作的。基于标题行、1手段Running2手段Succeeded。这不是最清晰的格式:4 行表头,需要参考表头才能弄清楚状态代码的实际含义,并且无法仅获取一项工作的状态。

为特定作业解析此输出的最简单方法是:

$ job_id=job_201309171413_38136
$ hadoop job -list all | awk -v job_id=${job_id} 'BEGIN{OFS="\t"; FS="\t"; final_state="Unknown"} $0 == "States are:" {getline; for(i=1;i<=NF;i++) { split($i,s," "); states[s[3]] = s[1] }} $1==job_id { final_state=states[$2]; exit} END{print final_state}'
Running

$ job_id=job_201309171413_37222
$ hadoop job -list all | awk -v job_id=${job_id} 'BEGIN{OFS="\t"; FS="\t"; final_state="Unknown"} $0 == "States are:" {getline; for(i=1;i<=NF;i++) { split($i,s," "); states[s[3]] = s[1] }} $1==job_id { final_state=states[$2]; exit} END{print final_state}'
Succeeded

$ job_id=foobar
$ hadoop job -list all | awk -v job_id=${job_id} 'BEGIN{OFS="\t"; FS="\t"; final_state="Unknown"} $0 == "States are:" {getline; for(i=1;i<=NF;i++) { split($i,s," "); states[s[3]] = s[1] }} $1==job_id { final_state=states[$2]; exit} END{print final_state}'
Unknown
于 2013-10-22T16:35:27.267 回答
3

我的hadoop版本是2.5.0。这适用于我
首先使用job_id

hadoop job -list

然后通过获取 job_id

hadoop job  -status {job_id}
于 2016-01-14T06:11:27.633 回答
0
hadoop job -list all
hadoop job -status <JobID>

或 hadoop jobtracker web-dashboard 将帮助您找到此错误或与工作相关的信息。

于 2020-07-06T21:44:48.403 回答