Search in sources :

Example 1 with TimelineEntityType

use of org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntityType in project hadoop by apache.

the class TimelineReaderManager method getEntity.

/**
   * Get single timeline entity by making a call to backend storage
   * implementation. The meaning of each argument in detail has been
   * documented with {@link TimelineReader#getEntity}. If cluster ID has not
   * been supplied by the client, fills the cluster id from config before making
   * a call to backend storage. After fetching entity from backend, fills the
   * appropriate UID based on entity type.
   *
   * @param context Timeline context within the scope of which entity has to be
   *     fetched.
   * @param dataToRetrieve Data to carry in the entity fetched.
   * @return A <cite>TimelineEntity</cite> object if found, null otherwise.
   * @throws IOException  if any problem occurs while getting entity.
   * @see TimelineReader#getEntity
   */
public TimelineEntity getEntity(TimelineReaderContext context, TimelineDataToRetrieve dataToRetrieve) throws IOException {
    context.setClusterId(getClusterID(context.getClusterId(), getConfig()));
    TimelineEntity entity = reader.getEntity(new TimelineReaderContext(context), dataToRetrieve);
    if (entity != null) {
        TimelineEntityType type = getTimelineEntityType(context.getEntityType());
        fillUID(type, entity, context);
    }
    return entity;
}
Also used : TimelineEntity(org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntity) TimelineEntityType(org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntityType)

Example 2 with TimelineEntityType

use of org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntityType in project hadoop by apache.

the class TimelineReaderManager method getEntities.

/**
   * Get a set of entities matching given predicates by making a call to
   * backend storage implementation. The meaning of each argument has been
   * documented in detail with {@link TimelineReader#getEntities}.If cluster ID
   * has not been supplied by the client, fills the cluster id from config
   * before making a call to backend storage. After fetching entities from
   * backend, fills the appropriate UID based on entity type for each entity.
   *
   * @param context Timeline context within the scope of which entities have to
   *     be fetched.
   * @param filters Filters which limit the number of entities to be returned.
   * @param dataToRetrieve Data to carry in each entity fetched.
   * @return a set of <cite>TimelineEntity</cite> objects.
   * @throws IOException if any problem occurs while getting entities.
   * @see TimelineReader#getEntities
   */
public Set<TimelineEntity> getEntities(TimelineReaderContext context, TimelineEntityFilters filters, TimelineDataToRetrieve dataToRetrieve) throws IOException {
    context.setClusterId(getClusterID(context.getClusterId(), getConfig()));
    Set<TimelineEntity> entities = reader.getEntities(new TimelineReaderContext(context), filters, dataToRetrieve);
    if (entities != null) {
        TimelineEntityType type = getTimelineEntityType(context.getEntityType());
        for (TimelineEntity entity : entities) {
            fillUID(type, entity, context);
        }
    }
    return entities;
}
Also used : TimelineEntity(org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntity) TimelineEntityType(org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntityType)

Aggregations

TimelineEntity (org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntity)2 TimelineEntityType (org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntityType)2