Class AggregatedLogFormat.LogReader

java.lang.Object
org.apache.hadoop.yarn.logaggregation.AggregatedLogFormat.LogReader
All Implemented Interfaces:
AutoCloseable
Enclosing class:
AggregatedLogFormat

@Public @Evolving public static class AggregatedLogFormat.LogReader extends Object implements AutoCloseable
  • Constructor Details

  • Method Details

    • getApplicationOwner

      public String getApplicationOwner() throws IOException
      Returns the owner of the application.
      Returns:
      the application owner.
      Throws:
      IOException - if we can not get the application owner.
    • getApplicationAcls

      public Map<ApplicationAccessType,String> getApplicationAcls() throws IOException
      Returns ACLs for the application. An empty map is returned if no ACLs are found.
      Returns:
      a map of the Application ACLs.
      Throws:
      IOException - if we can not get the application acls.
    • next

      Read the next key and return the value-stream.
      Parameters:
      key - the log key
      Returns:
      the valueStream if there are more keys or null otherwise
      Throws:
      IOException - if we can not get the dataInputStream for the next key
    • getContainerLogsReader

      @Private public org.apache.hadoop.yarn.logaggregation.AggregatedLogFormat.ContainerLogsReader getContainerLogsReader(ContainerId containerId) throws IOException
      Get a ContainerLogsReader to read the logs for the specified container.
      Parameters:
      containerId - the containerId
      Returns:
      object to read the container's logs or null if the logs could not be found
      Throws:
      IOException - if we can not get the container log reader.
    • readAcontainerLogs

      public static void readAcontainerLogs(DataInputStream valueStream, Writer writer, long logUploadedTime) throws IOException
      Writes all logs for a single container to the provided writer.
      Parameters:
      valueStream - the valueStream
      writer - the log writer
      logUploadedTime - the time stamp
      Throws:
      IOException - if we can not read the container logs.
    • readAcontainerLogs

      public static void readAcontainerLogs(DataInputStream valueStream, Writer writer) throws IOException
      Writes all logs for a single container to the provided writer.
      Parameters:
      valueStream - the value stream
      writer - the log writer
      Throws:
      IOException - if we can not read the container logs.
    • readAContainerLogsForALogType

      public static void readAContainerLogsForALogType(DataInputStream valueStream, PrintStream out, long logUploadedTime) throws IOException
      Keep calling this till you get a EOFException for getting logs of all types for a single container.
      Parameters:
      valueStream - the value stream
      out - the print stream
      logUploadedTime - the time stamp
      Throws:
      IOException - if we can not read the container log by specifying the container log type.
    • readAContainerLogsForALogType

      public static void readAContainerLogsForALogType(DataInputStream valueStream, PrintStream out, long logUploadedTime, long bytes) throws IOException
      Keep calling this till you get a EOFException for getting logs of all types for a single container for the specific bytes.
      Parameters:
      valueStream - the value stream
      out - the output print stream
      logUploadedTime - the log upload time stamp
      bytes - the output size of the log
      Throws:
      IOException - if we can not read the container log
    • readAContainerLogsForALogType

      public static void readAContainerLogsForALogType(DataInputStream valueStream, PrintStream out) throws IOException
      Keep calling this till you get a EOFException for getting logs of all types for a single container.
      Parameters:
      valueStream - the value stream
      out - the output print stream
      Throws:
      IOException - if we can not read the container log
    • readContainerLogsForALogType

      public static int readContainerLogsForALogType(DataInputStream valueStream, PrintStream out, long logUploadedTime, List<String> logType) throws IOException
      Keep calling this till you get a EOFException for getting logs of the specific types for a single container.
      Parameters:
      valueStream - the value stream
      out - the output print stream
      logUploadedTime - the log uploaded time stamp
      logType - the given log type
      Returns:
      If logType contains fileType, return 1, otherwise return 0.
      Throws:
      IOException - if we can not read the container logs
    • readContainerLogsForALogType

      public static int readContainerLogsForALogType(DataInputStream valueStream, PrintStream out, long logUploadedTime, List<String> logType, long bytes) throws IOException
      Keep calling this till you get a EOFException for getting logs of the specific types for a single container.
      Parameters:
      valueStream - the value stream
      out - the output print stream
      logUploadedTime - the log uploaded time stamp
      logType - the given log type
      bytes - log bytes.
      Returns:
      If logType contains fileType, return 1, otherwise return 0.
      Throws:
      IOException - if we can not read the container logs
    • readContainerMetaDataAndSkipData

      @Private public static org.apache.commons.math3.util.Pair<String,String> readContainerMetaDataAndSkipData(DataInputStream valueStream) throws IOException
      Throws:
      IOException
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable