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