如何使用oozie检查文件是否存在于HDFS位置?

How to check whether the file exist in HDFS location, using oozie?

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

在我的 HDFS 位置,我会在每天晚上 11 点 test_08_01_2016.csv 获得这样的文件。

我想在晚上 11 点 15 分之后检查这个文件是否存在。我可以使用 Oozie 协调器作业安排批处理。

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

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

<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 脚本构建文件名。