org.apache.hadoop.mapreduce.jobhistory

## Class HistoryViewer

- java.lang.Object
- - org.apache.hadoop.mapreduce.jobhistory.HistoryViewer

-     @InterfaceAudience.Private
       @InterfaceStability.Unstable
      public class HistoryViewer
      extends Object

  HistoryViewer is used to parse and view the JobHistory files. They can be printed in human-readable format or machine-readable JSON format using the `HistoryViewerPrinter`.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `HistoryViewer.AnalyzedJob` Utility class used while analyzing the job.
    `static class` | `HistoryViewer.FilteredJob` Utility to filter out events based on the task status
    `static class` | `HistoryViewer.SummarizedJob` Utility class used the summarize the job.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `HUMAN_FORMAT`
    `static String` | `JSON_FORMAT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HistoryViewer(String historyFile, org.apache.hadoop.conf.Configuration conf, boolean printAll)` Constructs the HistoryViewer object.
    `HistoryViewer(String historyFile, org.apache.hadoop.conf.Configuration conf, boolean printAll, String format)` Constructs the HistoryViewer object.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static String` | `getTaskLogsUrl(String scheme, JobHistoryParser.TaskAttemptInfo attempt)` Return the TaskLogsUrl of a particular TaskAttempt.
    `void` | `print()` Print the job/task/attempt summary information to stdout.
    `void` | `print(PrintStream ps)` Print the job/task/attempt summary information to the PrintStream.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### HUMAN_FORMAT

          public static final String HUMAN_FORMAT

      See Also:
        Constant Field Values

    - #### JSON_FORMAT

          public static final String JSON_FORMAT

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### HistoryViewer

          public HistoryViewer(String historyFile,
                               org.apache.hadoop.conf.Configuration conf,
                               boolean printAll)
                        throws IOException

      Constructs the HistoryViewer object.
      Parameters:
        `historyFile` - the fully qualified Path of the History File
        `conf` - the Configuration file
        `printAll` - toggle to print all status to only killed/failed status
      Throws:
        `IOException` - when there is a problem parsing the history file

    - #### HistoryViewer

          public HistoryViewer(String historyFile,
                               org.apache.hadoop.conf.Configuration conf,
                               boolean printAll,
                               String format)
                        throws IOException

      Constructs the HistoryViewer object.
      Parameters:
        `historyFile` - the fully qualified Path of the History File
        `conf` - the Configuration file
        `printAll` - toggle to print all status to only killed/failed status
        `format` - the output format to use
      Throws:
        `IOException` - when there is a problem parsing the history file

  - ### Method Detail

    - #### print

          public void print()
                     throws IOException

      Print the job/task/attempt summary information to stdout.
      Throws:
        `IOException` - when there is a problem printing the history

    - #### print

          public void print(PrintStream ps)
                     throws IOException

      Print the job/task/attempt summary information to the PrintStream.
      Parameters:
        `ps` - The PrintStream to print to
      Throws:
        `IOException` - when there is a problem printing the history

    - #### getTaskLogsUrl

          public static String getTaskLogsUrl(String scheme,
                                              JobHistoryParser.TaskAttemptInfo attempt)

      Return the TaskLogsUrl of a particular TaskAttempt.
      Parameters:
        `attempt` - info about the task attempt
      Returns:
        the taskLogsUrl. null if http-port or tracker-name or task-attempt-id are unavailable.

Copyright © 2008–2022 Apache Software Foundation. All rights reserved.