Oozie workflow工作流action间参数传递实现

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/dlg07/article/details/50857973

假设workflow里有两个action节点,shell和hive,hive需要用到shell节点里的值,shell脚本如下

#!/bin/sh
day=`date '+%Y%m%d%H'`
echo "day:$day"

hive节点需传入day这个参数。需要用到shell节点里<capture-output/>这个属性,如下

 

<action name="shell-118a ">
    <shell xmlns="uri:oozie:shell-action:0.1">
        <job-tracker>${jobTracker}</job-tracker>
        <name-node>${nameNode}</name-node>
        <configuration>
            <property>
                <name>mapred.job.queue.name</name>
                <value>${queueName}</value>
            </property>
        </configuration>
        <exec>${shell}</exec>
        <file>${shell}#${shell}</file>
        <capture-output/>
    </shell>
    <ok to="hive_node "/>
    <error to="fail"/>
</action>
<action name="hive_node">
        <hive xmlns="uri:oozie:hive-action:0.2">
              <job-tracker>${jobTracker}</job-tracker>
              <name-node>${nameNode}</name-node>
              <job-xml>${apps_hdfs_home}/common/conf/hive-site.xml</job-xml>
              <script>${sql}</script>
                <param>day=${wf:actionData('shell-118a')['day']}</param>
        </hive>
        <ok to="end"/>
        <error to="Kill"/>
 </action>




展开阅读全文

没有更多推荐了,返回首页