Skip to content

Commit

Permalink
Dr. Elephant should check for finished directory before listing
Browse files Browse the repository at this point in the history
  • Loading branch information
akshayrai committed Nov 17, 2017
1 parent e756226 commit 35d06d9
Showing 1 changed file with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,17 @@ private DataFiles getHistoryFiles(AnalyticJob job) throws IOException {

// Search files in done dir
String jobHistoryDirPath = getHistoryDir(job);
RemoteIterator<LocatedFileStatus> it = _fs.listFiles(new Path(jobHistoryDirPath), false);
while (it.hasNext() && (jobConfPath == null || jobHistPath == null)) {
String name = it.next().getPath().getName();
if (name.contains(jobId)) {
if (name.endsWith("_conf.xml")) {
jobConfPath = jobHistoryDirPath + name;
} else if (name.endsWith(".jhist")) {
jobHistPath = jobHistoryDirPath + name;

if (_fs.exists(new Path(jobHistoryDirPath))) {
RemoteIterator<LocatedFileStatus> it = _fs.listFiles(new Path(jobHistoryDirPath), false);
while (it.hasNext() && (jobConfPath == null || jobHistPath == null)) {
String name = it.next().getPath().getName();
if (name.contains(jobId)) {
if (name.endsWith("_conf.xml")) {
jobConfPath = jobHistoryDirPath + name;
} else if (name.endsWith(".jhist")) {
jobHistPath = jobHistoryDirPath + name;
}
}
}
}
Expand All @@ -178,7 +181,7 @@ private DataFiles getHistoryFiles(AnalyticJob job) throws IOException {
}
if (jobHistPath == null) {
try {
it = _fs.listFiles(new Path(intermediateDirPath), false);
RemoteIterator<LocatedFileStatus> it = _fs.listFiles(new Path(intermediateDirPath), false);
while (it.hasNext()) {
String name = it.next().getPath().getName();
if (name.contains(jobId) && name.endsWith(".jhist")) {
Expand Down

0 comments on commit 35d06d9

Please sign in to comment.