Skip to content

Commit

Permalink
Fix #279: TonY HistoryFileMover stops after the first job without a h…
Browse files Browse the repository at this point in the history
…istory file or that is still in progress (#280)

* Catch all exceptions in HistoryFileMover, do null check for jhistFilePath

* Fix #279: TonY HistoryFileMover stops after the first job without a history file or that is still in progress
  • Loading branch information
erwa committed May 9, 2019
1 parent d68ae0c commit 4fc04b4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
4 changes: 3 additions & 1 deletion tony-core/src/main/java/com/linkedin/tony/util/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,9 @@ public static int executeShell(String taskCommand, long timeout, Map<String, Str
String executablePath = taskCommand.trim().split(" ")[0];
File executable = new File(executablePath);
if (!executable.canExecute()) {
executable.setExecutable(true);
if (!executable.setExecutable(true)) {
LOG.error("Failed to make " + executable + " executable");
}
}

// Used for running unit tests in build boxes without Hadoop environment.
Expand Down
12 changes: 8 additions & 4 deletions tony-portal/app/history/HistoryFileMover.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,21 @@ public HistoryFileMover(Config appConf, Requirements requirements, CacheWrapper
LOG.error("Failed to list files in " + intermediateDir, e);
}
if (jobDirs != null) {
moveIntermediateToFinished(fs, jobDirs);
try {
moveIntermediateToFinished(fs, jobDirs);
} catch (Exception e) {
LOG.error("Encountered exception while moving history directories", e);
}
}
}, 0, moverIntervalMs, TimeUnit.MILLISECONDS);
}

private void moveIntermediateToFinished(FileSystem fs, FileStatus[] jobDirs) {
for (FileStatus jobDir : jobDirs) {
String jhistFilePath = ParserUtils.getJhistFilePath(fs, jobDir.getPath());
cacheWrapper.updateCaches(jobDir.getPath());
if (jobInProgress(jhistFilePath)) {
return;
String jhistFilePath = ParserUtils.getJhistFilePath(fs, jobDir.getPath());
if (jhistFilePath == null || jobInProgress(jhistFilePath)) {
continue;
}

Path source = new Path(jhistFilePath).getParent();
Expand Down
2 changes: 1 addition & 1 deletion tony-portal/conf/application.example.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ tony {
location = "/tmp/tony-history"
intermediate = "/tmp/tony-history/intermediate"
finished = "/tmp/tony-history/finished"
mover-interval-ms = "5000"
mover-interval-ms = "300000"
}
portal {
cache.max-entries = "2000"
Expand Down

0 comments on commit 4fc04b4

Please sign in to comment.