How to know job flow id, other cluster parameters in script running via script-runner.jar

大憨熊 提交于 2019-12-06 15:48:15

Instead of using a Shell script, you could use a Ruby script:

#!/usr/bin/ruby

require 'json'
require 'emr/common'

job_flow = Emr::JsonInfoFile.new('job-flow')
job_flow_id = job_flow['jobFlowId']

You can also get info on the job steps, for example:

step_one = Emr::JsonInfoFile.new('steps/1')
state = step_one['state']

or instance info:

instance_info = Emr::JsonInfoFile.new('instance')
is_master = instance_info['isMaster']

Basically, everything in the /mnt/var/lib/info/ directory is available through this interface.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!