oozie 学习笔记 action

action node出发workflowe 任务,可以是pig,java等!

action触发的任务,都是在远程运行,而不是在oozie中运行!

触发的tasks 都是异步执行的,只有等到所有的tasks都执行完毕,才能调到下一个节点,同步执行的除外

oozie课通过回调(有唯一的URL),或者轮询探知任务结束,task应使用url通知,为防止网络等原因oozie会轮询探知任务结束!


Actions Have 2 Transitions, =ok= and =error=

If a computation/processing task -triggered by a workflow- completes successfully, it transitions took .

If a computation/processing task -triggered by a workflow- fails to complete successfully, its transitions toerror .

If a computation/processing task exits in error, there computation/processing task must provideerror-code and error-message information to Oozie. This information can be used fromdecision nodes to implement a fine grain error handling at workflow application level.

Each action type must clearly define all the error codes it can produce.

成功 跳转到ok

失败 error

每一个erro必须定义error-code ,erroe-message information, infomation 可以用老决定-----

每一个action必须定义所有可能产生的error code


Map-Reduce ActionMap-Reduce Action

触发一个map-reduce任务

可以用来配置在执行前清理文件

阻塞直到map-reduce工作结束,才跳转到下一个action

退出状态,exit status (=FAILED=, KILLED or SUCCEEDED)-->决定跳转到那个节点

所有map-reduce必须的一些配置,可通过

  • the config-default.xml or
  • JobConf XML file bundled with the workflow application or
  • tag in workflow definition or  workflowd的定义标签
  • Inline map-reduce action configuration or   在map-reduce ction的内部定义
  • An implementation of OozieActionConfigurator specified by the tag in workflow definition.

     

    For example:

    package com.example;import org.apache.hadoop.fs.Path;
    import org.apache.hadoop.mapred.FileInputFormat;
    import org.apache.hadoop.mapred.FileOutputFormat;
    import org.apache.hadoop.mapred.JobConf;
    import org.apache.oozie.action.hadoop.OozieActionConfigurator;
    import org.apache.oozie.action.hadoop.OozieActionConfiguratorException;
    import org.apache.oozie.example.SampleMapper;
    import org.apache.oozie.example.SampleReducer;
    public class MyConfigClass implements OozieActionConfigurator {
        @Override
        public void configure(JobConf actionConf) throws OozieActionConfiguratorException {
            if (actionConf.getUser() == null) {
                throw new OozieActionConfiguratorException("No user set");
            }
            actionConf.setMapperClass(SampleMapper.class);
            actionConf.setReducerClass(SampleReducer.class);
            FileInputFormat.setInputPaths(actionConf, new Path("/user/" + actionConf.getUser() + "/input-data"));
            FileOutputFormat.setOutputPath(actionConf, new Path("/user/" + actionConf.getUser() + "/output"));
            ...
        }
    }
    

     

    <workflow-app name="[WF-DEF-NAME]" xmlns="uri:oozie:workflow:0.5">    ...    <action name="[NODE-NAME]">        <map-reduce>            ...            <job-xml>[JOB-XML-FILE]</job-xml>            <configuration>                <property>                    <name>[PROPERTY-NAME]</name>                    <value>[PROPERTY-VALUE]</value>                </property>                ...            </configuration>            <config-class>com.example.MyConfigClass</config-class>            ...        </map-reduce>        <ok to="[NODE-NAME]"/>        <error to="[NODE-NAME]"/>    </action>    ...</workflow-app>

    Adding Files and Archives for the Job

    The file, archive elements make available, to map-reduce jobs, files and archives. If the specified path is relative, it is assumed the file or archiver are within the application directory, in the corresponding sub-path. If the path is absolute, the file or archive it is expected in the given absolute path.

    Files specified with the file element, will be symbolic links in the home directory of the task.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值