/// <summary>Constructs the HistoryViewer object</summary> /// <param name="historyFile">The fully qualified Path of the History File</param> /// <param name="conf">The Configuration file</param> /// <param name="printAll">Toggle to print all status to only killed/failed status</param> /// <exception cref="System.IO.IOException"/> public HistoryViewer(string historyFile, Configuration conf, bool printAll) { this.printAll = printAll; string errorMsg = "Unable to initialize History Viewer"; try { Path jobFile = new Path(historyFile); fs = jobFile.GetFileSystem(conf); string[] jobDetails = jobFile.GetName().Split("_"); if (jobDetails.Length < 2) { // NOT a valid name System.Console.Error.WriteLine("Ignore unrecognized file: " + jobFile.GetName()); throw new IOException(errorMsg); } JobHistoryParser parser = new JobHistoryParser(fs, jobFile); job = parser.Parse(); jobId = job.GetJobId().ToString(); } catch (Exception e) { throw new IOException(errorMsg, e); } }
/// <exception cref="System.IO.IOException"/> private void Parse() { FSDataInputStream @in = null; try { @in = GetPreviousJobHistoryFileStream(GetConfig(), applicationAttemptId); } catch (IOException e) { Log.Warn("error trying to open previous history file. No history data " + "will be copied over." , e); return; } JobHistoryParser parser = new JobHistoryParser(@in); parser.Parse(this); Exception parseException = parser.GetParseException(); if (parseException != null) { Log.Info("Got an error parsing job-history file" + ", ignoring incomplete events." , parseException); } }