首页 > 代码库 > Oozie workflow工作流action间参数传递实现

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

假设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>  

 

 

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