in webindex/modules/data/src/main/java/webindex/data/spark/IndexEnv.java [161:181]
public static void validateDataDir(String dataDir) {
try {
FileSystem hdfs = getHDFS();
Path dataPath = new Path(dataDir);
if (!hdfs.exists(dataPath)) {
log.error("HDFS data directory {} does not exist", dataDir);
System.exit(-1);
}
RemoteIterator<LocatedFileStatus> listIter = hdfs.listFiles(dataPath, true);
while (listIter.hasNext()) {
LocatedFileStatus status = listIter.next();
if (status.isFile()) {
return;
}
}
log.error("HDFS data directory {} has no files", dataDir);
System.exit(-1);
} catch (IOException e) {
throw new IllegalStateException(e);
}
}