Hadoop链作业-如果输入文件未退出,则跳过第二个作业



我有两个hadoop作业。第一个作业将输出保存在hdfs文件中,第二个作业将此文件作为输入。当这个文件不存在时,我有错误。如果第一个作业外文件不存在,我如何跳过第二个作业?

使用此测试,但使用第一个作业创建的路径:

FileSystem fs = FileSystem.get(conf);
String inputDir= "HDFS file path";  
if (fs.exists(new Path(inputDir))) { 
    // this block gets executed only if the file path inputDir exists
}

块内的代码将包含第二个作业的配置和执行代码。

最新更新