【发布时间】:2013-12-10 12:45:17
【问题描述】:
我有两个 hadoop 工作。第一个作业将输出保存在 hdfs 文件中,第二个作业将该文件作为输入。当此文件不存在时,我有错误。如果第一个作业 outfile 不存在,我如何跳过第二个作业?
【问题讨论】:
标签: hadoop
我有两个 hadoop 工作。第一个作业将输出保存在 hdfs 文件中,第二个作业将该文件作为输入。当此文件不存在时,我有错误。如果第一个作业 outfile 不存在,我如何跳过第二个作业?
【问题讨论】:
标签: hadoop
使用此测试,但使用第一个作业创建的路径:
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
}
块内的代码将包含第二个作业的配置和执行代码。
【讨论】: