[英]Oozie Workflow : How to get current action node name?
How to get the name
of current action
in oozie workflow? 如何在oozie工作流中获取当前
action
的name
?
Eg : 例如:
<action name="hello_action">
<shell xmlns="uri:oozie:shell-action:0.1">
<job-tracker>${jobTracker}</job-tracker>
<name-node>${nameNode}</name-node>
<exec>/user/nz/printActionName.sh</exec>
<argument><!-- PASS current action name i.e. hello_action --></argument>
<file>/user/nz/printActionName.sh#printActionName.sh</file>
<capture-output/>
</shell>
<ok to="end"/>
<error to="fail"/>
</action>
Currently there is no way in Oozie to get the current action node name. 当前,Oozie中无法获取当前操作节点名称。 However, the workaround would be:
但是,解决方法是:
When Oozie submits the Shell Action to YARN, it ships a XML file with some information about the current Workflow and Action, and sets an env. 当Oozie将Shell Action提交给YARN时,它将附带一个XML文件,其中包含有关当前Workflow和Action的一些信息,并设置一个env。 variable to point to that file.
指向该文件的变量。 Just parse the XML with sed and voila .
只需使用sed和voila解析XML。
if [[ "$CONTAINER_ID" != "" && "$OOZIE_ACTION_CONF_XML" != "" ]]
then
RawDump=$(/bin/sed -n '/<name>mapreduce.job.name<\/name>/ { N ; s/^.*<value>oozie:action:/:/ ; s/<\/value>.*$/:/ ; p}' "$OOZIE_ACTION_CONF_XML")
MyOozieWorkflow=$(/bin/echo "$RawDump" | /bin/sed -n '/:W=[^:]*:/ { s/^.*W=// ; s/:.*$// ; p }')
MyOozieJobId=$( /bin/echo "$RawDump" | /bin/sed -n '/:ID=[^:]*:/ { s/^.*ID=// ; s/:.*$// ; p }')
MyOozieAction=$( /bin/echo "$RawDump" | /bin/sed -n '/:A=[^:]*:/ { s/^.*A=// ; s/:.*$// ; p }')
else
MyOozieWorkflow='None'
MyOozieJobId='None'
MyOozieAction='None'
fi
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.