The job.properties file content
job.properties
user.name=admin
oozie.use.system.libpath=true
nameNode=hdfs://nameNode-value:8020
jobTracker=nameNode-value:8021
queueName=default
propertyB1=B1
propertyB2=B2
propertyB3=B3
propertyC1=C1
propertyC2=C2
propertyC3=C3
hdfs_target_path=/tmp/workspace
hdfs_main_target_path=/tmp/main_workflow_space
hdfs_target_file_path=${hdfs_target_path}/files
oozie.wf.application.path=${hdfs_main_target_path}
The main workflow.xml content
main workflow.xml
<workflow-app name="main-workflow" xmlns="uri:oozie:workflow:0.4"> <!-- This xml file is in: ${nameNode}/tmp/main_workflow_space -->
<start to="fork-begin"/>
<fork name="fork-begin">
<path start="sub1" />
<path start="sub2" />
<path start="sub3" />
</fork>
<action name="sub1">
<sub-workflow>
<app-path>${nameNode}/tmp/sub_workflow_space</app-path> <!-- The place where sub-workflow(sub workflow.xml) is in -->
<propagate-configuration/>
<configuration>
<property>
<name>propertyC</name> <!-- Can not be used in this way: property.C -->
<value>${propertyC1}</value> <!-- From job.properties -->
</property>
<property>
<name>propertyB</name> <!-- Can not be used in this way: property.B -->
<value>${propertyB1}</value> <!-- From job.properties -->
</property>
</configuration>
</sub-workflow>
<ok to="join-end"/>
<error to="kill"/>
</action>
<action name="sub2">
<sub-workflow>
<app-path>${nameNode}/tmp/sub_workflow_space</app-path>
<propagate-configuration/>
<configuration>
<property>
<name>propertyC</name>
<value>${propertyC2}</value>
</property>
<property>
<name>propertyB</name>
<value>${propertyB2}</value>
</property>
</configuration>
</sub-workflow>
<ok to="join-end"/>
<error to="kill"/>
</action>
<action name="sub3">
<sub-workflow>
<app-path>${nameNode}/tmp/sub_workflow_space</app-path>
<propagate-configuration/>
<configuration>
<property>
<name>propertyC</name>
<value>${propertyC3}</value>
</property>
<property>
<name>propertyB</name>
<value>${propertyB3}</value>
</property>
</configuration>
</sub-workflow>
<ok to="join-end"/>
<error to="kill"/>
</action>
<join name="join-end" to="end"/>
<kill name="kill">
<message>Action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
</kill>
<end name="end"/>
</workflow-app>
The sub workflow.xml content
sub workflow.xml
<workflow-app name="sub-workflow" xmlns="uri:oozie:workflow:0.4"> <!-- This file is in: ${nameNode}/tmp/sub_workflow_space -->
<start to="step1"/>
<action name="step1">
<java>
<job-tracker>${jobTracker}</job-tracker>
<name-node>${nameNode}</name-node>
<prepare>
<delete path="${nameNode}${hdfs_target_file_path}/${propertyB}"/> <!-- ${propertyB} is from main workflow.xml property -->
</prepare>
<configuration>
<property>
<name>property.X</name>
<value>${propertyX}</value> <!-- From job.properties -->
</property>
<property>
<name>property.Y</name>
<value>${propertyY}</value> <!-- From job.properties -->
</property>
<property>
<name>property.B</name>
<value>${propertyB}</value> <!-- ${propertyB} is from main workflow.xml property -->
</property>
</configuration>
<main-class>com.vandy.example.transToHdfs</main-class>
<file>${hdfs_target_file_path}/id_rsa#id_rsa</file>
</java>
<ok to="step2"/>
<error to="kill"/>
</action>
<action name="step2">
<pig>
<job-tracker>${jobTracker}</job-tracker>
<name-node>${nameNode}</name-node>
<prepare>
<delete path="${nameNode}${hdfs_target_file_path}/${propertyC}"/> <!-- ${propertyC} is from main workflow.xml property -->
</prepare>
<script>${hdfs_target_file_path}/Merger.pig</script>
<param>fileA='${hdfs_target_file_path}/A'</param>
<param>fileB='${hdfs_target_file_path}/${propertyB}'</param> <!-- ${propertyB} is from main workflow.xml property -->
</pig>
<ok to="step3"/>
<error to="kill"/>
</action>
<action name="step3">
<java>
<job-tracker>${jobTracker}</job-tracker>
<name-node>${nameNode}</name-node>
<configuration>
<property>
<name>property.X</name>
<value>${propertyX}</value>
</property>
<property>
<name>property.Y</name>
<value>${propertyY}</value>
</property>
<property>
<name>property.C</name>
<value>${propertyC}</value> <!-- ${propertyC} is from main workflow.xml property -->
</property>
</configuration>
<main-class>com.vandy.example.transToSFTP</main-class>
<file>${hdfs_target_file_path}/id_rsa#id_rsa</file>
</java>
<ok to="end"/>
<error to="kill"/>
</action>
<kill name="kill">
<message>Action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
</kill>
<end name="end"/>
</workflow-app>
In a word, the real workflow sequence is : job.properties –> main workflow.xml –> sub workflow.xml.