Hadoop:hadoop Oozie Main sub workflow.xml configuration

Source: Internet
Author: User
Tags join prepare xmlns
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 was in: ${namenode}/tmp/ Main_workflow_space--<start to= "Fork-begin"/> <fork name= "Fork-begin" > <path start= "s Ub1 "/> <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) are in-<propagate-configuration/>            <configuration> <property> <name>propertyC</name> <!--Can not is used in this way:property.
                C--<value>${propertyC1}</value> <!--from Job.properties-- </property> <property> &LT;NAME&GT;PROPERTYB&LT;/name> <!--Can not is 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> &L
                    T;/property> <property> <name>propertyB</name> <value>${propertyB3}</value> </property> </configuration> &L t;/sub-workflow> <ok to= "Join-end"/> <error to= "Kill"/> </action> <join na Me= "Join-end" to= "End"/> <kill name= "Kill" > <message>action failed, error message[${wf:errormes Sage (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 was in: ${namenode}/tmp/sub_ Workflow_space--<start to= "Step1"/> <action name= "Step1" > <java> <j Ob-tracker>${jobtracker}</job-tracker> <name-node>${nameNode}</name-node> &lt ;p repare> <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 to </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 WORKF Low.xml Property--</property> </configuration> <main-class&gt ;com.vandy.example.transtohdfs</main-class> <file>${hdfs_target_file_path}/id_rsa#id_rsa</file&
        Gt </java> <ok to= "Step2"/> <error to= "Kill"/> </action> <action name= "Ste P2 "> <pig> <job-tracker>${jobTracker}</job-tracker> <name-node> ${namenode}</name-node> <prepare> <delete path= "${namenode}${hdfs_target_file_p
            ATH}/${PROPERTYC} "/> <!--${PROPERTYC} is from main Workflow.xml property--</prepare> <scRipt>${hdfs_target_file_path}/merger.pig</script> <param>fileA=& #39; ${hdfs_target_file_path }/a& #39;</param> <param>fileB=& #39;${hdfs_target_file_path}/${propertyb}& #39; </para M> <!--${propertyb} is from main Workflow.xml property--</pig> <ok to= "Step3"/&G
        T <error to= "Kill"/> </action> <action name= "Step3" > <java> <job-trac Ker>${jobtracker}</job-tracker> <name-node>${nameNode}</name-node> <config Uration> <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> &LT;MAIN-CL Ass>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 ())}]</messa ge> </kill> <end name= "End"/> </workflow-app>

In a word, the real workflow sequence is: job.properties –> main workflow.xml –&G T Sub Workflow.xml .

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.