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.