Search in sources :

Example 61 with TimelineReaderContext

use of org.apache.hadoop.yarn.server.timelineservice.reader.TimelineReaderContext in project hadoop by apache.

the class ApplicationEntityReader method augmentParams.

@Override
protected void augmentParams(Configuration hbaseConf, Connection conn) throws IOException {
    TimelineReaderContext context = getContext();
    if (isSingleEntityRead()) {
        // Get flow context information from AppToFlow table.
        if (context.getFlowName() == null || context.getFlowRunId() == null || context.getUserId() == null) {
            AppToFlowRowKey appToFlowRowKey = new AppToFlowRowKey(context.getClusterId(), context.getAppId());
            FlowContext flowContext = lookupFlowContext(appToFlowRowKey, hbaseConf, conn);
            context.setFlowName(flowContext.getFlowName());
            context.setFlowRunId(flowContext.getFlowRunId());
            context.setUserId(flowContext.getUserId());
        }
    }
    // Add configs/metrics to fields to retrieve if confsToRetrieve and/or
    // metricsToRetrieve are specified.
    getDataToRetrieve().addFieldsBasedOnConfsAndMetricsToRetrieve();
    if (!isSingleEntityRead()) {
        createFiltersIfNull();
    }
}
Also used : TimelineReaderContext(org.apache.hadoop.yarn.server.timelineservice.reader.TimelineReaderContext) AppToFlowRowKey(org.apache.hadoop.yarn.server.timelineservice.storage.apptoflow.AppToFlowRowKey)

Example 62 with TimelineReaderContext

use of org.apache.hadoop.yarn.server.timelineservice.reader.TimelineReaderContext in project hadoop by apache.

the class FlowRunEntityReader method getResults.

@Override
protected ResultScanner getResults(Configuration hbaseConf, Connection conn, FilterList filterList) throws IOException {
    Scan scan = new Scan();
    TimelineReaderContext context = getContext();
    RowKeyPrefix<FlowRunRowKey> flowRunRowKeyPrefix = new FlowRunRowKeyPrefix(context.getClusterId(), context.getUserId(), context.getFlowName());
    scan.setRowPrefixFilter(flowRunRowKeyPrefix.getRowKeyPrefix());
    FilterList newList = new FilterList();
    newList.addFilter(new PageFilter(getFilters().getLimit()));
    if (filterList != null && !filterList.getFilters().isEmpty()) {
        newList.addFilter(filterList);
    }
    scan.setFilter(newList);
    scan.setMaxVersions(Integer.MAX_VALUE);
    return getTable().getResultScanner(hbaseConf, conn, scan);
}
Also used : TimelineReaderContext(org.apache.hadoop.yarn.server.timelineservice.reader.TimelineReaderContext) FlowRunRowKey(org.apache.hadoop.yarn.server.timelineservice.storage.flow.FlowRunRowKey) FlowRunRowKeyPrefix(org.apache.hadoop.yarn.server.timelineservice.storage.flow.FlowRunRowKeyPrefix) Scan(org.apache.hadoop.hbase.client.Scan) FilterList(org.apache.hadoop.hbase.filter.FilterList) TimelineFilterList(org.apache.hadoop.yarn.server.timelineservice.reader.filter.TimelineFilterList) PageFilter(org.apache.hadoop.hbase.filter.PageFilter)

Example 63 with TimelineReaderContext

use of org.apache.hadoop.yarn.server.timelineservice.reader.TimelineReaderContext in project hadoop by apache.

the class GenericEntityReader method augmentParams.

@Override
protected void augmentParams(Configuration hbaseConf, Connection conn) throws IOException {
    TimelineReaderContext context = getContext();
    // In reality all three should be null or neither should be null
    if (context.getFlowName() == null || context.getFlowRunId() == null || context.getUserId() == null) {
        // Get flow context information from AppToFlow table.
        AppToFlowRowKey appToFlowRowKey = new AppToFlowRowKey(context.getClusterId(), context.getAppId());
        FlowContext flowContext = lookupFlowContext(appToFlowRowKey, hbaseConf, conn);
        context.setFlowName(flowContext.flowName);
        context.setFlowRunId(flowContext.flowRunId);
        context.setUserId(flowContext.userId);
    }
    // Add configs/metrics to fields to retrieve if confsToRetrieve and/or
    // metricsToRetrieve are specified.
    getDataToRetrieve().addFieldsBasedOnConfsAndMetricsToRetrieve();
    if (!isSingleEntityRead()) {
        createFiltersIfNull();
    }
}
Also used : TimelineReaderContext(org.apache.hadoop.yarn.server.timelineservice.reader.TimelineReaderContext) AppToFlowRowKey(org.apache.hadoop.yarn.server.timelineservice.storage.apptoflow.AppToFlowRowKey)

Aggregations

TimelineReaderContext (org.apache.hadoop.yarn.server.timelineservice.reader.TimelineReaderContext)63 TimelineEntity (org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntity)54 TimelineDataToRetrieve (org.apache.hadoop.yarn.server.timelineservice.reader.TimelineDataToRetrieve)54 Test (org.junit.Test)54 TimelineEntityFilters (org.apache.hadoop.yarn.server.timelineservice.reader.TimelineEntityFilters)44 TimelineFilterList (org.apache.hadoop.yarn.server.timelineservice.reader.filter.TimelineFilterList)28 Configuration (org.apache.hadoop.conf.Configuration)14 TimelineEntities (org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntities)14 TimelinePrefixFilter (org.apache.hadoop.yarn.server.timelineservice.reader.filter.TimelinePrefixFilter)10 HashSet (java.util.HashSet)9 TimelineMetric (org.apache.hadoop.yarn.api.records.timelineservice.TimelineMetric)9 HBaseTimelineReaderImpl (org.apache.hadoop.yarn.server.timelineservice.storage.HBaseTimelineReaderImpl)9 HBaseTimelineWriterImpl (org.apache.hadoop.yarn.server.timelineservice.storage.HBaseTimelineWriterImpl)9 Get (org.apache.hadoop.hbase.client.Get)7 TimelineKeyValueFilter (org.apache.hadoop.yarn.server.timelineservice.reader.filter.TimelineKeyValueFilter)7 Connection (org.apache.hadoop.hbase.client.Connection)6 Result (org.apache.hadoop.hbase.client.Result)6 TimelineCompareFilter (org.apache.hadoop.yarn.server.timelineservice.reader.filter.TimelineCompareFilter)6 TimelineKeyValuesFilter (org.apache.hadoop.yarn.server.timelineservice.reader.filter.TimelineKeyValuesFilter)6 HashMap (java.util.HashMap)5