堕落不振功业废,勤耕不辍日月新

分享一个Oozie Job Debug脚本

Python hailen 488℃

参考资料:
https://oozie.apache.org/docs/4.0.0/WebServicesAPI.html

背景介绍:
在我们的线上Hadoop集群中,采用了Oozie来作为Workflow的管理,而平时有不少Workflow在执行过程中会因为各种问题而失败。
于是,我们通常都会通过Oozie Web Console去Troubleshooting,但是整个过程并不方便,在研究了Oozie API之后,我写了一个脚本来自动化的帮我们完成绝大部分的Troubleshooting步骤。

具体配置:
整个脚本需要模拟的Troubleshooting思路如下:
1. 获取整个Workflow所有步骤的信息,通常的状态有:OK,RUNNING,FAILED,KILLED
2. 对FAILED和KILLED状态的步骤,首先获取其consoleUrl,然后进一步获取更有价值的logsLinks,同时打印相关的调试信息,并导出该步骤的相关XML配置文件

脚本地址:https://github.com/mcsrainbow/python-demos/blob/master/demos/debug_oozie_job.py

执行示例:

[dong@idc1-server1 ~]$ debug_oozie_job.py --server idc1-hive1 --job_id 0011096-160121234010195-oozie-oozi-C@2387
##################################
externalId: 0061222-160121234010195-oozie-oozi-W
status: 'OK', name: 'fork-1'
status: 'OK', name: ':start:'
status: 'OK', name: 'check-point'
status: 'OK', name: 'daily-decision'
status: 'OK', name: 'extract-labelpair-profiles'
status: 'OK', name: 'extract-web-profiles'
status: 'ERROR', name: 'extract-nobid-profiles'
  consoleUrl: 'http://idc1-rm1.heylinux.com:8100/proxy/application_1458783473169_227279'
  logsLinks:
    http://idc1-rm1.heylinux.com:19888/jobhistory/logs/idc1-node1.heylinux.com:43483/container_1458783473169_227279_01_000002/attempt_1458783473169_227279_m_000000_0/oozie
  *DEBUG*:
    status: 'ERROR'
    retries: '0'
    transition: 'email-error'
    stats: 'None'
    startTime: 'Tue, 24 May 2016 02:50:19 GMT'
    toString: 'Action name[extract-nobid-profiles] status[ERROR]'
    cred: 'null'
    errorMessage: 'None'
    errorCode: 'None'
    consoleUrl: 'http://idc1-rm1.heylinux.com:8100/proxy/application_1458783473169_227279'
    externalId: 'job_1458783473169_227279'
    externalStatus: 'FAILED/KILLED'
    conf: '/tmp/0011096-160121234010195-oozie-oozi-C@2387_extract-nobid-profiles.xml'
    type: 'map-reduce'
    trackerUri: 'idc1-rm1:8032'
    externalChildIDs: ''
    endTime: 'Tue, 24 May 2016 03:24:42 GMT'
    data: 'None'
    id: '0061222-160121234010195-oozie-oozi-W@extract-nobid-profiles'
    name: 'extract-nobid-profiles'
status: 'OK', name: 'extract-data-profiles'
status: 'OK', name: 'extract-optout-profiles'
status: 'OK', name: 'fail'
status: 'OK', name: 'email-error'
##################################
Please check the URLs in "logsLinks" above for detailed informations.
Do NOT ignore the messages in "Log Type: stdout".

转载请注明:我是IT » 分享一个Oozie Job Debug脚本

喜欢 (0)or分享 (0)