oozie工作流定义

介绍

oozie工作流定义_第1张图片

流程定义

oozie工作流定义_第2张图片

流程节点

oozie工作流定义_第3张图片

启动节点

oozie工作流定义_第4张图片

结束节点

oozie工作流定义_第5张图片

Kill Control Node

oozie工作流定义_第6张图片

Map-Reduce Action

  • A map-reduce action can be configured to perform file system cleanup and directory creation before starting the map reduce job. This capability enables Oozie to retry a Hadoop job in the situation of a transient failure (Hadoop checks the non-existence of the job output directory and then creates it when the Hadoop job is starting, thus a retry without cleanup of the job output directory would fail).运行文件系统前清理以前的输出

  • The workflow job will wait until the Hadoop map/reduce job completes before continuing to the next action in the workflow execution path.工作流中,一个动作完成后才能进行到下一个动作

  • The counters of the Hadoop job and job exit status (=FAILED=, KILLED or SUCCEEDED ) must be available to the workflow job after the Hadoop jobs ends. This information can be used from within decision nodes and other actions configurations.在Hadoop作业结束后,Hadoop作业和作业退出状态的计数器(=FILIL=、KIND或WITED)必须可用于工作流作业
  • The map-reduce action has to be configured with all the necessary Hadoop JobConf properties to run the Hadoop map/reduce job.
    oozie工作流定义_第7张图片

  • 任务定义(job define)

"[WF-DEF-NAME]" xmlns="uri:oozie:workflow:0.5">
    ...
    "[NODE-NAME]">
        
            ...
            [JOB-XML-FILE]
            
                
                    [PROPERTY-NAME]
                    [PROPERTY-VALUE]
                
                ...
            
            com.example.MyConfigClass
            ...
        
        "[NODE-NAME]"/>
        "[NODE-NAME]"/>
    
    ...

shell action

The shell action runs a Shell command.
The workflow job will wait until the Shell command completes before continuing to the next action.
To run the Shell job, you have to configure the shell action with the =job-tracker=, name-node and Shell exec elements as well as the necessary arguments and configuration.
A shell action can be configured to create or delete HDFS directories before starting the Shell job.
+ Syntax:

"[WF-DEF-NAME]" xmlns="uri:oozie:workflow:0.3">
    ...
    "[NODE-NAME]">
        "uri:oozie:shell-action:0.1">
            [JOB-TRACKER]
            [NAME-NODE]
            
               "[PATH]"/>
               ...
               "[PATH]"/>
               ...
            
            [SHELL SETTINGS FILE]
            
                
                    [PROPERTY-NAME]
                    [PROPERTY-VALUE]
                
                ...
            
            [SHELL-COMMAND]
            [ARG-VALUE]
                ...
            [ARG-VALUE]
            [VAR1=VALUE1]
               ...
            [VARN=VALUEN]
            [FILE-PATH]
            ...
            [FILE-PATH]
            ...
            
        
        "[NODE-NAME]"/>
        "[NODE-NAME]"/>
    
    ...
  • Example:How to run any shell script or perl script or CPP executable
<workflow-app xmlns='uri:oozie:workflow:0.3' name='shell-wf'>
    <start to='shell1' />
    <action name='shell1'>
        <shell xmlns="uri:oozie:shell-action:0.1">
            <job-tracker>${jobTracker}job-tracker>
            <name-node>${nameNode}name-node>
            <configuration>
                <property>
                  <name>mapred.job.queue.namename>
                  <value>${queueName}value>
                property>
            configuration>
            <exec>${EXEC}exec>
            <argument>Aargument>
            <argument>Bargument>
            <file>${EXEC}#${EXEC}file> 
        shell>
        <ok to="end" />
        <error to="fail" />
    action>
    <kill name="fail">
        <message>Script failed, error message[${wf:errorMessage(wf:lastErrorNode())}]message>
    kill>
    <end name='end' />
workflow-app>

The corresponding job properties file used to submit Oozie job could be as follows:

oozie工作流定义_第8张图片

你可能感兴趣的:(oozie)