我有一个oozie工作流,它将调用一个shell文件,Shell文件将进一步调用mapreduce作业的驱动程序类。现在,我想将我的oozie jobId映射到Mapreduce jobId以供以后的处理。是否有任何方法在工作流文件中获取oozie jobId,以便将与参数相同的参数传递给我的驱动程序类进行映射。
下面是我的示例workflow.xml文件
<workflow-app xmlns="uri:oozie:workflow:0.4" name="test">
<start to="start-test" />
<action name='start-test'>
<shell xmlns="uri:oozie:shell-action:0.2">
<job-tracker>${jobTracker}</job-tracker>
<name-node>${nameNode}</name-node>
<configuration>
<property>
<name>mapred.job.queue.name</name>
<value>${queueName}</value>
</property>
</configuration>
<exec>${jobScript}</exec>
<argument>${fileLocation}</argument>
<argument>${nameNode}</argument>
<argument>${jobId}</argument> <!-- this is how i wanted to pass oozie jobId -->
<file>${jobScriptWithPath}#${jobScript}</file>
</shell>
<ok to="end" />
<error to="kill" />
</action>
<kill name="kill">
<message>test job failed
failed:[${wf:errorMessage(wf:lastErrorNode())}]</message>
</kill>
<end name="end" />
下面是我的shell脚本。
hadoop jar testProject.jar testProject.MrDriver $1 $2 $3发布于 2015-10-13 15:46:53
发布于 2015-10-13 22:33:44
Oozie在运行shell的纱线容器( "launcher“容器)的CWD中删除一个XML文件,并设置指向该XML的env变量(但不记得名称)。
该XML包含许多内容,如工作流名称、操作名称、两个名称的ID、运行尝试号等。因此,您可以在sed脚本本身中返回该信息。
当然,显式传递ID (如Alexei所建议的)会更干净,但有时“干净”并不是最好的方法。尤其是如果你担心这是否是第一次.
https://stackoverflow.com/questions/33105087
复制相似问题