关于Oozie的input-events和done-flag
2015-06-16 10:22
302 查看
关于Oozie的input-events和done-flag
工作流的执行条件
当coordinator指定的一个workflow已经进入执行时间窗口时,oozie会首先检查所有的input-events是否都已“发生”(满足),检查主要是分两个方面:指定的文件或文件夹是否已经存在?
如果指定了done-flag, 检查done-flag文件是否存在
当切仅当所有的input-events都已发生,工作流才会进入runing状态,否则, oozie会持续监视指定的文件或文件夹,一但它们创建出来,或者生成了done-flag文件,工作流会立即进入running状态。
关于done-flag
从应用的角度来看,如是监视的是文件或文件夹,在它们建立的那一刻,数据可能并未写入完整,此时立即执行action可能会丢失数据或出现错误,一个好的处理方法是等所有文件写出完成之后,写一个标志文件,能过这个标志文件来启动action,这就是 done-flag的作用!以下是官方文档中对done-flag的说明:
If the done-flag is omitted the coordinator will wait for the presence of a _SUCCESS file in the directory (Note: MapReduce jobs create this on successful completion automatically).
If the done-flag is present but empty, then the existence of the directory itself indicates that the dataset is ready.
If the done-flag is present but non-empty, Oozie will check for the presence of the named file within the directory, and will be considered ready (done)
对于done-flag需要说明的是:
对于input event, 当它引用的dateset指定了done-flag,则oozie在执行action之前会“读”这个flag文件,以判断是否可以开始后续的动作。需要特别注意的是:input event不是一定要被某个action作为参数(配置属性)来引用,虽然大多数时候是这样的,如果一个input event没有被任何action引用,实际上它起到的是“输入检查”的作用,也就是在开始任何action之前,检查制定的文件或文件夹是否存在,如果指定了done flag文件,再检查done flag文件是否存在。
对于output event, 当它引用的dateset指定了done-flag, oozie并不会在执行action之后去“写”这个flag文件。
done-flag是一种非常巧妙的标记文件已就绪的做法,可以说是已经是大数据领域里最为常见的一种“模式”。典型的例子是MR在执行任务结束时生成的_SUCCESS文件。
生成done-flag是如此普遍的需要,以至于hdfs的cli直接提供了命令用于生成done-flag文件,以及是一个例子:
#Create a flag file named _SUCCESS under a certain input folder. hdfs dfs -touchz "/puth/to/input/folder/_SUCCESS"
相关文章推荐
- [.NET领域驱动设计实战系列]专题八:DDD案例:网上书店分布式消息队列和分布式缓存的实现
- 201506160850_《JavaScript权威指南(第六版)——方法调用》(P168-171)
- vs2008团队资源管理器安装步骤
- 数据库连接数问题
- 【selenium】下拉框和弹出框处理
- Rectangle Area
- scrollview嵌套listview
- 聊天室服务器程序
- android 开发环境搭建 eclipse支持,解决dl-ssl.google.com资源下载不动问题
- 《C++语言基础》实践参考——max带来的冲突
- Java去除掉HTML里面所有标签的两种方法——开源jar包和自己写正则表达式
- LeetCode之“动态规划”:Edit Distance
- ASP.NET创建动态缩略图的方法
- XAMPP Mysql 忘记root密码解决方案
- log4net的典型配置
- Android内存优化之封装九宫格
- Moravec算子
- 《征服C指针》——读书笔记(4)
- ZH奶酪:纯CSS自定义Html中Checkbox复选框样式
- 【SSO单点系列】(7):CAS4.0 SERVER通过数据库方式认证用户