|
@@ -339,8 +339,11 @@ public class TestJobHistoryParsing {
|
|
PrintStream stdps = System.out;
|
|
PrintStream stdps = System.out;
|
|
try {
|
|
try {
|
|
System.setOut(new PrintStream(outContent));
|
|
System.setOut(new PrintStream(outContent));
|
|
- HistoryViewer viewer = new HistoryViewer(fc.makeQualified(
|
|
|
|
- fileInfo.getHistoryFile()).toString(), conf, true);
|
|
|
|
|
|
+ HistoryViewer viewer;
|
|
|
|
+ synchronized (fileInfo) {
|
|
|
|
+ viewer = new HistoryViewer(fc.makeQualified(
|
|
|
|
+ fileInfo.getHistoryFile()).toString(), conf, true);
|
|
|
|
+ }
|
|
viewer.print();
|
|
viewer.print();
|
|
|
|
|
|
for (TaskInfo taskInfo : allTasks.values()) {
|
|
for (TaskInfo taskInfo : allTasks.values()) {
|
|
@@ -397,29 +400,27 @@ public class TestJobHistoryParsing {
|
|
// make sure all events are flushed
|
|
// make sure all events are flushed
|
|
app.waitForState(Service.STATE.STOPPED);
|
|
app.waitForState(Service.STATE.STOPPED);
|
|
|
|
|
|
- String jobhistoryDir = JobHistoryUtils
|
|
|
|
- .getHistoryIntermediateDoneDirForUser(conf);
|
|
|
|
JobHistory jobHistory = new JobHistory();
|
|
JobHistory jobHistory = new JobHistory();
|
|
jobHistory.init(conf);
|
|
jobHistory.init(conf);
|
|
|
|
+ HistoryFileInfo fileInfo = jobHistory.getJobFileInfo(jobId);
|
|
|
|
+
|
|
|
|
+ JobHistoryParser parser;
|
|
|
|
+ JobInfo jobInfo;
|
|
|
|
+ synchronized (fileInfo) {
|
|
|
|
+ Path historyFilePath = fileInfo.getHistoryFile();
|
|
|
|
+ FSDataInputStream in = null;
|
|
|
|
+ FileContext fc = null;
|
|
|
|
+ try {
|
|
|
|
+ fc = FileContext.getFileContext(conf);
|
|
|
|
+ in = fc.open(fc.makeQualified(historyFilePath));
|
|
|
|
+ } catch (IOException ioe) {
|
|
|
|
+ LOG.info("Can not open history file: " + historyFilePath, ioe);
|
|
|
|
+ throw (new Exception("Can not open History File"));
|
|
|
|
+ }
|
|
|
|
|
|
- JobIndexInfo jobIndexInfo = jobHistory.getJobFileInfo(jobId)
|
|
|
|
- .getJobIndexInfo();
|
|
|
|
- String jobhistoryFileName = FileNameIndexUtils
|
|
|
|
- .getDoneFileName(jobIndexInfo);
|
|
|
|
-
|
|
|
|
- Path historyFilePath = new Path(jobhistoryDir, jobhistoryFileName);
|
|
|
|
- FSDataInputStream in = null;
|
|
|
|
- FileContext fc = null;
|
|
|
|
- try {
|
|
|
|
- fc = FileContext.getFileContext(conf);
|
|
|
|
- in = fc.open(fc.makeQualified(historyFilePath));
|
|
|
|
- } catch (IOException ioe) {
|
|
|
|
- LOG.info("Can not open history file: " + historyFilePath, ioe);
|
|
|
|
- throw (new Exception("Can not open History File"));
|
|
|
|
|
|
+ parser = new JobHistoryParser(in);
|
|
|
|
+ jobInfo = parser.parse();
|
|
}
|
|
}
|
|
-
|
|
|
|
- JobHistoryParser parser = new JobHistoryParser(in);
|
|
|
|
- JobInfo jobInfo = parser.parse();
|
|
|
|
Exception parseException = parser.getParseException();
|
|
Exception parseException = parser.getParseException();
|
|
Assert.assertNull("Caught an expected exception " + parseException,
|
|
Assert.assertNull("Caught an expected exception " + parseException,
|
|
parseException);
|
|
parseException);
|
|
@@ -464,29 +465,28 @@ public class TestJobHistoryParsing {
|
|
// make sure all events are flushed
|
|
// make sure all events are flushed
|
|
app.waitForState(Service.STATE.STOPPED);
|
|
app.waitForState(Service.STATE.STOPPED);
|
|
|
|
|
|
- String jobhistoryDir = JobHistoryUtils
|
|
|
|
- .getHistoryIntermediateDoneDirForUser(conf);
|
|
|
|
JobHistory jobHistory = new JobHistory();
|
|
JobHistory jobHistory = new JobHistory();
|
|
jobHistory.init(conf);
|
|
jobHistory.init(conf);
|
|
|
|
|
|
- JobIndexInfo jobIndexInfo = jobHistory.getJobFileInfo(jobId)
|
|
|
|
- .getJobIndexInfo();
|
|
|
|
- String jobhistoryFileName = FileNameIndexUtils
|
|
|
|
- .getDoneFileName(jobIndexInfo);
|
|
|
|
|
|
+ HistoryFileInfo fileInfo = jobHistory.getJobFileInfo(jobId);
|
|
|
|
+
|
|
|
|
+ JobHistoryParser parser;
|
|
|
|
+ JobInfo jobInfo;
|
|
|
|
+ synchronized (fileInfo) {
|
|
|
|
+ Path historyFilePath = fileInfo.getHistoryFile();
|
|
|
|
+ FSDataInputStream in = null;
|
|
|
|
+ FileContext fc = null;
|
|
|
|
+ try {
|
|
|
|
+ fc = FileContext.getFileContext(conf);
|
|
|
|
+ in = fc.open(fc.makeQualified(historyFilePath));
|
|
|
|
+ } catch (IOException ioe) {
|
|
|
|
+ LOG.info("Can not open history file: " + historyFilePath, ioe);
|
|
|
|
+ throw (new Exception("Can not open History File"));
|
|
|
|
+ }
|
|
|
|
|
|
- Path historyFilePath = new Path(jobhistoryDir, jobhistoryFileName);
|
|
|
|
- FSDataInputStream in = null;
|
|
|
|
- FileContext fc = null;
|
|
|
|
- try {
|
|
|
|
- fc = FileContext.getFileContext(conf);
|
|
|
|
- in = fc.open(fc.makeQualified(historyFilePath));
|
|
|
|
- } catch (IOException ioe) {
|
|
|
|
- LOG.info("Can not open history file: " + historyFilePath, ioe);
|
|
|
|
- throw (new Exception("Can not open History File"));
|
|
|
|
|
|
+ parser = new JobHistoryParser(in);
|
|
|
|
+ jobInfo = parser.parse();
|
|
}
|
|
}
|
|
-
|
|
|
|
- JobHistoryParser parser = new JobHistoryParser(in);
|
|
|
|
- JobInfo jobInfo = parser.parse();
|
|
|
|
Exception parseException = parser.getParseException();
|
|
Exception parseException = parser.getParseException();
|
|
Assert.assertNull("Caught an expected exception " + parseException,
|
|
Assert.assertNull("Caught an expected exception " + parseException,
|
|
parseException);
|
|
parseException);
|