Search in sources :

Example 6 with ApplicationRowKey

use of org.apache.hadoop.yarn.server.timelineservice.storage.application.ApplicationRowKey in project hadoop by apache.

the class ApplicationEntityReader method getResult.

@Override
protected Result getResult(Configuration hbaseConf, Connection conn, FilterList filterList) throws IOException {
    TimelineReaderContext context = getContext();
    ApplicationRowKey applicationRowKey = new ApplicationRowKey(context.getClusterId(), context.getUserId(), context.getFlowName(), context.getFlowRunId(), context.getAppId());
    byte[] rowKey = applicationRowKey.getRowKey();
    Get get = new Get(rowKey);
    get.setMaxVersions(getDataToRetrieve().getMetricsLimit());
    if (filterList != null && !filterList.getFilters().isEmpty()) {
        get.setFilter(filterList);
    }
    return getTable().getResult(hbaseConf, conn, get);
}
Also used : TimelineReaderContext(org.apache.hadoop.yarn.server.timelineservice.reader.TimelineReaderContext) ApplicationRowKey(org.apache.hadoop.yarn.server.timelineservice.storage.application.ApplicationRowKey) Get(org.apache.hadoop.hbase.client.Get)

Example 7 with ApplicationRowKey

use of org.apache.hadoop.yarn.server.timelineservice.storage.application.ApplicationRowKey in project hadoop by apache.

the class TestRowKeys method testApplicationRowKey.

@Test
public void testApplicationRowKey() {
    byte[] byteRowKey = new ApplicationRowKey(CLUSTER, USER, FLOW_NAME, FLOW_RUN_ID, APPLICATION_ID).getRowKey();
    ApplicationRowKey rowKey = ApplicationRowKey.parseRowKey(byteRowKey);
    assertEquals(CLUSTER, rowKey.getClusterId());
    assertEquals(USER, rowKey.getUserId());
    assertEquals(FLOW_NAME, rowKey.getFlowName());
    assertEquals(FLOW_RUN_ID, rowKey.getFlowRunId());
    assertEquals(APPLICATION_ID, rowKey.getAppId());
    byte[] byteRowKeyPrefix = new ApplicationRowKeyPrefix(CLUSTER, USER, FLOW_NAME, FLOW_RUN_ID).getRowKeyPrefix();
    byte[][] splits = Separator.QUALIFIERS.split(byteRowKeyPrefix, new int[] { Separator.VARIABLE_SIZE, Separator.VARIABLE_SIZE, Separator.VARIABLE_SIZE, Bytes.SIZEOF_LONG, Separator.VARIABLE_SIZE });
    assertEquals(5, splits.length);
    assertEquals(0, splits[4].length);
    assertEquals(FLOW_NAME, Separator.QUALIFIERS.decode(Bytes.toString(splits[2])));
    assertEquals(FLOW_RUN_ID, (Long) LongConverter.invertLong(Bytes.toLong(splits[3])));
    verifyRowPrefixBytes(byteRowKeyPrefix);
    byteRowKeyPrefix = new ApplicationRowKeyPrefix(CLUSTER, USER, FLOW_NAME).getRowKeyPrefix();
    splits = Separator.QUALIFIERS.split(byteRowKeyPrefix, new int[] { Separator.VARIABLE_SIZE, Separator.VARIABLE_SIZE, Separator.VARIABLE_SIZE, Separator.VARIABLE_SIZE });
    assertEquals(4, splits.length);
    assertEquals(0, splits[3].length);
    assertEquals(FLOW_NAME, Separator.QUALIFIERS.decode(Bytes.toString(splits[2])));
    verifyRowPrefixBytes(byteRowKeyPrefix);
}
Also used : ApplicationRowKeyPrefix(org.apache.hadoop.yarn.server.timelineservice.storage.application.ApplicationRowKeyPrefix) ApplicationRowKey(org.apache.hadoop.yarn.server.timelineservice.storage.application.ApplicationRowKey) Test(org.junit.Test)

Aggregations

ApplicationRowKey (org.apache.hadoop.yarn.server.timelineservice.storage.application.ApplicationRowKey)7 TimelineReaderContext (org.apache.hadoop.yarn.server.timelineservice.reader.TimelineReaderContext)4 Get (org.apache.hadoop.hbase.client.Get)3 TimelineEntity (org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntity)3 Test (org.junit.Test)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2 NavigableMap (java.util.NavigableMap)2 Configuration (org.apache.hadoop.conf.Configuration)2 Connection (org.apache.hadoop.hbase.client.Connection)2 Result (org.apache.hadoop.hbase.client.Result)2 ApplicationEntity (org.apache.hadoop.yarn.api.records.timelineservice.ApplicationEntity)2 TimelineEntities (org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntities)2 TimelineEvent (org.apache.hadoop.yarn.api.records.timelineservice.TimelineEvent)2 TimelineDataToRetrieve (org.apache.hadoop.yarn.server.timelineservice.reader.TimelineDataToRetrieve)2 ApplicationRowKeyPrefix (org.apache.hadoop.yarn.server.timelineservice.storage.application.ApplicationRowKeyPrefix)2 ApplicationTable (org.apache.hadoop.yarn.server.timelineservice.storage.application.ApplicationTable)2 EnumSet (java.util.EnumSet)1 HashSet (java.util.HashSet)1 NavigableSet (java.util.NavigableSet)1