gpt4 book ai didi

hadoop - 如何在oozie工作流中获取oozie jobId?

转载 作者:可可西里 更新时间:2023-11-01 15:00:57 24 4
gpt4 key购买 nike

我有一个将调用 shell 文件的 oozie 工作流,Shell 文件将进一步调用 mapreduce 作业的驱动程序类。现在我想将我的 oozie jobId 映射到 Mapreduce jobId 以供以后处理。有什么方法可以在工作流文件中获取 oozie jobId,以便我可以将相同的 as 参数传递给我的驱动程序类以进行映射。

以下是我的示例 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

最佳答案

尝试使用${wf:id()}:

String wf:id()

It returns the workflow job ID for the current workflow job.

More info here.

关于hadoop - 如何在oozie工作流中获取oozie jobId?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33105087/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com