如何使用oozie检查文件是否存在于HDFS位置? [英] How to check whether the file exist in HDFS location, using oozie?

查看:200
本文介绍了如何使用oozie检查文件是否存在于HDFS位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用Oozie检查HDFS位置中的文件是否存在?

How to check whether a file in HDFS location is exist or not, using Oozie?

在我的HDFS位置,每天晚上11点我都会得到一个类似test_08_01_2016.csv的文件.

In my HDFS location I will get a file like this test_08_01_2016.csv at 11PM , on a daily basis.

我要检查11.15 PM之后该文件是否存在.我可以使用Oozie协调器作业来计划批处理.

I want check whether this file exist after 11.15 PM. I can schedule the batch using a Oozie coordinator job.

但是如何验证HDFS中是否存在该文件?

But how can I validate if the file exists in HDFS?

推荐答案

您可以在oozie中使用EL表达式,例如:

you can use EL expression in oozie like:

<decision name="CheckFile">
         <switch>
            <case to="nextOozieTask">
              ${fs:exists('/path/test_08_01_2016.csv')} <!--do note the path which should be in ''-->
            </case>
            <default to="MailActionFileMissing" />
         </switch>
</decision>

您还可以使用捕获输出使用简单的shell脚本构建文件的名称.

You can also build the name of the file using simple shell script using capture output.

这篇关于如何使用oozie检查文件是否存在于HDFS位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆