Class TimelineUtils
java.lang.Object
org.apache.hadoop.yarn.util.timeline.TimelineUtils
The helper class for the timeline module.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.hadoop.io.TextbuildTimelineTokenService(org.apache.hadoop.conf.Configuration conf) static org.apache.hadoop.yarn.api.records.timeline.TimelineAboutcreateTimelineAbout(String about) static StringSerialize a POJO object into a JSON string not in a pretty formatstatic StringdumpTimelineRecordtoJSON(Object o, boolean pretty) Serialize a POJO object into a JSON stringstatic StringgenerateDefaultFlowName(String appName, org.apache.hadoop.yarn.api.records.ApplicationId appId) static StringgenerateFlowNameTag(String flowName) Generate flow name tag.static StringgenerateFlowRunIdTag(long flowRunId) Generate flow run ID tag.static StringgenerateFlowVersionTag(String flowVersion) Generate flow version tag.static floatgetTimelineServiceVersion(org.apache.hadoop.conf.Configuration conf) Returns the timeline service version.static InetSocketAddressgetTimelineTokenServiceAddress(org.apache.hadoop.conf.Configuration conf) static StringshortenFlowName(String flowName, org.apache.hadoop.conf.Configuration conf) Shortens the flow name for the configured size by removing UUID if present.static booleantimelineServiceEnabled(org.apache.hadoop.conf.Configuration conf) Returns whether the timeline service is enabled via configuration.static booleantimelineServiceV1_5Enabled(org.apache.hadoop.conf.Configuration conf) Returns whether the timeline service v.1.5 is enabled by default via configuration.
-
Field Details
-
FLOW_NAME_TAG_PREFIX
- See Also:
-
FLOW_VERSION_TAG_PREFIX
- See Also:
-
FLOW_RUN_ID_TAG_PREFIX
- See Also:
-
DEFAULT_FLOW_VERSION
- See Also:
-
-
Constructor Details
-
TimelineUtils
public TimelineUtils()
-
-
Method Details
-
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- io error occur.com.fasterxml.jackson.databind.JsonMappingException- exception used to signal fatal problems with mapping of content.com.fasterxml.jackson.core.JsonGenerationException- exception type for exceptions during JSON writing.
-
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 serializepretty- whether in a pretty format or not- Returns:
- a JSON string
- Throws:
IOException- io error occur.com.fasterxml.jackson.databind.JsonMappingException- exception used to signal fatal problems with mapping of content.com.fasterxml.jackson.core.JsonGenerationException- exception type for exceptions during JSON writing.
-
timelineServiceEnabled
public static boolean timelineServiceEnabled(org.apache.hadoop.conf.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(org.apache.hadoop.conf.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(org.apache.hadoop.conf.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 org.apache.hadoop.yarn.api.records.timeline.TimelineAbout createTimelineAbout(String about) -
getTimelineTokenServiceAddress
public static InetSocketAddress getTimelineTokenServiceAddress(org.apache.hadoop.conf.Configuration conf) -
buildTimelineTokenService
public static org.apache.hadoop.io.Text buildTimelineTokenService(org.apache.hadoop.conf.Configuration conf) -
generateDefaultFlowName
-
generateFlowNameTag
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
Shortens the flow name for the configured size by removing UUID if present.- Parameters:
flowName- which has to be shortenedconf- to resize the flow name- Returns:
- shortened flowName
-
generateFlowVersionTag
Generate flow version tag.- Parameters:
flowVersion- flow version that keeps track of the changes made to the flow- Returns:
- flow version tag.
-
generateFlowRunIdTag
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.
-