Class NoOpTimelineReaderImpl

java.lang.Object
org.apache.hadoop.service.AbstractService
org.apache.hadoop.yarn.server.timelineservice.storage.NoOpTimelineReaderImpl
All Implemented Interfaces:
Closeable, AutoCloseable, org.apache.hadoop.service.Service, TimelineReader

public class NoOpTimelineReaderImpl extends org.apache.hadoop.service.AbstractService implements TimelineReader
Stub based implementation for TimelineReader. This implementation will not provide a complete implementation of all the necessary features. This implementation is provided solely for basic testing purposes.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.apache.hadoop.service.Service

    org.apache.hadoop.service.Service.STATE

    Nested classes/interfaces inherited from interface org.apache.hadoop.yarn.server.timelineservice.storage.TimelineReader

    TimelineReader.Field
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Set<org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntity>
    The API to search for a set of entities of the given entity type in the scope of the given context which matches the given predicates.
    org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntity
    The API to fetch the single entity given the identifier(depending on the entity type) in the scope of the given context.
    The API to list all available entity types of the given context.
    org.apache.hadoop.yarn.api.records.timeline.TimelineHealth
    Check if reader connection is working properly.

    Methods inherited from class org.apache.hadoop.service.AbstractService

    close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, serviceInit, serviceStart, serviceStop, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface org.apache.hadoop.service.Service

    close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, registerServiceListener, start, stop, unregisterServiceListener, waitForServiceToStop
  • Constructor Details

    • NoOpTimelineReaderImpl

      public NoOpTimelineReaderImpl()
  • Method Details

    • getEntity

      public org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntity getEntity(TimelineReaderContext context, TimelineDataToRetrieve dataToRetrieve) throws IOException
      Description copied from interface: TimelineReader

      The API to fetch the single entity given the identifier(depending on the entity type) in the scope of the given context.

      Specified by:
      getEntity in interface TimelineReader
      Parameters:
      context - Context which defines the scope in which query has to be made. Use getters of TimelineReaderContext to fetch context fields. Context contains the following :
      • entityType - Entity type(mandatory).
      • clusterId - Identifies the cluster(mandatory).
      • userId - Identifies the user.
      • flowName - Context flow name.
      • flowRunId - Context flow run id.
      • appId - Context app id.
      • entityId - Entity id.
      Fields in context which are mandatory depends on entity type. Entity type is always mandatory. In addition to entity type, below is the list of context fields which are mandatory, based on entity type.
      • If entity type is YARN_FLOW_RUN (i.e. query to fetch a specific flow run), clusterId, userId, flowName and flowRunId are mandatory.
      • If entity type is YARN_APPLICATION (i.e. query to fetch a specific app), query is within the scope of clusterId, userId, flowName, flowRunId and appId. But out of this, only clusterId and appId are mandatory. If only clusterId and appId are supplied, backend storage must fetch the flow context information i.e. userId, flowName and flowRunId first and based on that, fetch the app. If flow context information is also given, app can be directly fetched.
      • For other entity types (i.e. query to fetch generic entity), query is within the scope of clusterId, userId, flowName, flowRunId, appId, entityType and entityId. But out of this, only clusterId, appId, entityType and entityId are mandatory. If flow context information is not supplied, backend storage must fetch the flow context information i.e. userId, flowName and flowRunId first and based on that, fetch the entity. If flow context information is also given, entity can be directly queried.
      dataToRetrieve - Specifies which data to retrieve for the entity. Use getters of TimelineDataToRetrieve class to fetch dataToRetrieve fields. All the dataToRetrieve fields are optional. Refer to TimelineDataToRetrieve for details.
      Returns:
      A TimelineEntity instance or null. The entity will contain the metadata plus the given fields to retrieve.
      If entityType is YARN_FLOW_RUN, entity returned is of type FlowRunEntity.
      For all other entity types, entity returned is of type TimelineEntity.
      Throws:
      IOException - if there is an exception encountered while fetching entity from backend storage.
    • getEntities

      public Set<org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntity> getEntities(TimelineReaderContext context, TimelineEntityFilters filters, TimelineDataToRetrieve dataToRetrieve) throws IOException
      Description copied from interface: TimelineReader

      The API to search for a set of entities of the given entity type in the scope of the given context which matches the given predicates. The predicates include the created time window, limit to number of entities to be returned, and the entities can be filtered by checking whether they contain the given info/configs entries in the form of key/value pairs, given metrics in the form of metricsIds and its relation with metric values, given events in the form of the Ids, and whether they relate to/are related to other entities. For those parameters which have multiple entries, the qualified entity needs to meet all or them.

      Specified by:
      getEntities in interface TimelineReader
      Parameters:
      context - Context which defines the scope in which query has to be made. Use getters of TimelineReaderContext to fetch context fields. Context contains the following :
      • entityType - Entity type(mandatory).
      • clusterId - Identifies the cluster(mandatory).
      • userId - Identifies the user.
      • flowName - Context flow name.
      • flowRunId - Context flow run id.
      • appId - Context app id.
      Although entityIdPrefix and entityId are also part of context, it has no meaning for getEntities.
      Fields in context which are mandatory depends on entity type. Entity type is always mandatory. In addition to entity type, below is the list of context fields which are mandatory, based on entity type.
      • If entity type is YARN_FLOW_ACTIVITY (i.e. query to fetch flows), only clusterId is mandatory.
      • If entity type is YARN_FLOW_RUN (i.e. query to fetch flow runs), clusterId, userId and flowName are mandatory.
      • If entity type is YARN_APPLICATION (i.e. query to fetch apps), we can either get all apps within the context of flow name or within the context of flow run. If apps are queried within the scope of flow name, clusterId, userId and flowName are supplied. If they are queried within the scope of flow run, clusterId, userId, flowName and flowRunId are supplied.
      • For other entity types (i.e. query to fetch generic entities), query is within the scope of clusterId, userId, flowName, flowRunId, appId and entityType. But out of this, only clusterId, appId and entityType are mandatory. If flow context information is not supplied, backend storage must fetch the flow context information i.e. userId, flowName and flowRunId first and based on that, fetch the entities. If flow context information is also given, entities can be directly queried.
      filters - Specifies filters which restrict the number of entities to return. Use getters of TimelineEntityFilters class to fetch various filters. All the filters are optional. Refer to TimelineEntityFilters for details.
      dataToRetrieve - Specifies which data to retrieve for each entity. Use getters of TimelineDataToRetrieve class to fetch dataToRetrieve fields. All the dataToRetrieve fields are optional. Refer to TimelineDataToRetrieve for details.
      Returns:
      A set of TimelineEntity instances of the given entity type in the given context scope which matches the given predicates ordered by enitityIdPrefix(for generic entities only). Each entity will only contain the metadata(id, type , idPrefix and created time) plus the given fields to retrieve.
      If entityType is YARN_FLOW_ACTIVITY, entities returned are of type FlowActivityEntity.
      If entityType is YARN_FLOW_RUN, entities returned are of type FlowRunEntity.
      For all other entity types, entities returned are of type TimelineEntity.
      Throws:
      IOException - if there is an exception encountered while fetching entity from backend storage.
    • getEntityTypes

      public Set<String> getEntityTypes(TimelineReaderContext context) throws IOException
      Description copied from interface: TimelineReader
      The API to list all available entity types of the given context.
      Specified by:
      getEntityTypes in interface TimelineReader
      Parameters:
      context - A context defines the scope of this query. The incoming context should contain at least the cluster id and application id.
      Returns:
      A set of entity types available in the given context.
      Throws:
      IOException - if an exception occurred while listing from backend storage.
    • getHealthStatus

      public org.apache.hadoop.yarn.api.records.timeline.TimelineHealth getHealthStatus()
      Description copied from interface: TimelineReader
      Check if reader connection is working properly.
      Specified by:
      getHealthStatus in interface TimelineReader
      Returns:
      True if reader connection works as expected, false otherwise.