org.apache.hadoop.yarn.util.timeline

## Class TimelineUtils

- java.lang.Object
- - org.apache.hadoop.yarn.util.timeline.TimelineUtils

-     @InterfaceAudience.Public
       @InterfaceStability.Evolving
      public class TimelineUtils
      extends Object

  The helper class for the timeline module.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `DEFAULT_FLOW_VERSION`
    `static String` | `FLOW_NAME_TAG_PREFIX`
    `static String` | `FLOW_RUN_ID_TAG_PREFIX`
    `static String` | `FLOW_VERSION_TAG_PREFIX`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TimelineUtils()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Text` | `buildTimelineTokenService(Configuration conf)`
    `static TimelineAbout` | `createTimelineAbout(String about)`
    `static String` | `dumpTimelineRecordtoJSON(Object o)` Serialize a POJO object into a JSON string not in a pretty format
    `static String` | `dumpTimelineRecordtoJSON(Object o, boolean pretty)` Serialize a POJO object into a JSON string
    `static String` | `generateDefaultFlowName(String appName, ApplicationId appId)`
    `static String` | `generateFlowNameTag(String flowName)` Generate flow name tag.
    `static String` | `generateFlowRunIdTag(long flowRunId)` Generate flow run ID tag.
    `static String` | `generateFlowVersionTag(String flowVersion)` Generate flow version tag.
    `static float` | `getTimelineServiceVersion(Configuration conf)` Returns the timeline service version.
    `static InetSocketAddress` | `getTimelineTokenServiceAddress(Configuration conf)`
    `static String` | `shortenFlowName(String flowName, Configuration conf)` Shortens the flow name for the configured size by removing UUID if present.
    `static boolean` | `timelineServiceEnabled(Configuration conf)` Returns whether the timeline service is enabled via configuration.
    `static boolean` | `timelineServiceV1_5Enabled(Configuration conf)` Returns whether the timeline service v.1.5 is enabled by default via configuration.

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

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

- - ### Field Detail

    - #### FLOW_NAME_TAG_PREFIX

          public static final String FLOW_NAME_TAG_PREFIX

      See Also:
        Constant Field Values

    - #### FLOW_VERSION_TAG_PREFIX

          public static final String FLOW_VERSION_TAG_PREFIX

      See Also:
        Constant Field Values

    - #### FLOW_RUN_ID_TAG_PREFIX

          public static final String FLOW_RUN_ID_TAG_PREFIX

      See Also:
        Constant Field Values

    - #### DEFAULT_FLOW_VERSION

          public static final String DEFAULT_FLOW_VERSION

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### TimelineUtils

          public TimelineUtils()

  - ### Method Detail

    - #### dumpTimelineRecordtoJSON

          public static String dumpTimelineRecordtoJSON(Object o)
                                                 throws com.fasterxml.jackson.core.JsonGenerationException,
                                                        com.fasterxml.jackson.databind.JsonMappingException,
                                                        IOException

      Serialize a POJO object into a JSON string not in a pretty format
      Parameters:
        `o` - an object to serialize
      Returns:
        a JSON string
      Throws:
        `IOException`
        `com.fasterxml.jackson.databind.JsonMappingException`
        `com.fasterxml.jackson.core.JsonGenerationException`

    - #### dumpTimelineRecordtoJSON

          public static String dumpTimelineRecordtoJSON(Object o,
                                                        boolean pretty)
                                                 throws com.fasterxml.jackson.core.JsonGenerationException,
                                                        com.fasterxml.jackson.databind.JsonMappingException,
                                                        IOException

      Serialize a POJO object into a JSON string
      Parameters:
        `o` - an object to serialize
        `pretty` - whether in a pretty format or not
      Returns:
        a JSON string
      Throws:
        `IOException`
        `com.fasterxml.jackson.databind.JsonMappingException`
        `com.fasterxml.jackson.core.JsonGenerationException`

    - #### timelineServiceEnabled

          public static boolean timelineServiceEnabled(Configuration conf)

      Returns whether the timeline service is enabled via configuration.
      Parameters:
        `conf` - the configuration
      Returns:
        whether the timeline service is enabled.

    - #### getTimelineServiceVersion

          public static float getTimelineServiceVersion(Configuration conf)

      Returns the timeline service version. It does not check whether the timeline service itself is enabled.
      Parameters:
        `conf` - the configuration
      Returns:
        the timeline service version as a float.

    - #### timelineServiceV1_5Enabled

          public static boolean timelineServiceV1_5Enabled(Configuration conf)

      Returns whether the timeline service v.1.5 is enabled by default via configuration.
      Parameters:
        `conf` - the configuration
      Returns:
        whether the timeline service v.1.5 is enabled. V.1.5 refers to a version equal to 1.5.

    - #### createTimelineAbout

          public static TimelineAbout createTimelineAbout(String about)

    - #### getTimelineTokenServiceAddress

          public static InetSocketAddress getTimelineTokenServiceAddress(Configuration conf)

    - #### buildTimelineTokenService

          public static Text buildTimelineTokenService(Configuration conf)

    - #### generateDefaultFlowName

          public static String generateDefaultFlowName(String appName,
                                                       ApplicationId appId)

    - #### generateFlowNameTag

          public static String generateFlowNameTag(String flowName)

      Generate flow name tag.
      Parameters:
        `flowName` - flow name that identifies a distinct flow application which can be run repeatedly over time
      Returns:
        flow name tag.

    - #### shortenFlowName

          public static String shortenFlowName(String flowName,
                                               Configuration conf)

      Shortens the flow name for the configured size by removing UUID if present.
      Parameters:
        `flowName` - which has to be shortened
        `conf` - to resize the flow name
      Returns:
        shortened flowName

    - #### generateFlowVersionTag

          public static String generateFlowVersionTag(String flowVersion)

      Generate flow version tag.
      Parameters:
        `flowVersion` - flow version that keeps track of the changes made to the flow
      Returns:
        flow version tag.

    - #### generateFlowRunIdTag

          public static String generateFlowRunIdTag(long flowRunId)

      Generate flow run ID tag.
      Parameters:
        `flowRunId` - flow run ID that identifies one instance (or specific execution) of that flow
      Returns:
        flow run id tag.

Copyright © 2022 Apache Software Foundation. All rights reserved.