【问题标题】:Hadoop Chain Jobs - Skip second Job if input files does not exitHadoop 链作业 - 如果输入文件不退出,则跳过第二个作业
【发布时间】:2013-12-10 12:45:17
【问题描述】:

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

【问题讨论】:

    标签: hadoop


    【解决方案1】:

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

    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
    
    }
    

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

    【讨论】:

    • 如果我要检查文件而不是文件夹?
    • @EleftheriosK.,解决这个问题好运吗?
    猜你喜欢
    • 1970-01-01
    • 2016-06-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-22
    • 1970-01-01
    相关资源
    最近更新 更多