Search in sources :

Example 1 with FetchStatsLogger

use of org.apache.tez.runtime.library.common.shuffle.ShuffleUtils.FetchStatsLogger in project tez by apache.

the class TestShuffleUtils method testFetchStatsLogger.

@Test
public void testFetchStatsLogger() throws Exception {
    Logger activeLogger = mock(Logger.class);
    Logger aggregateLogger = mock(Logger.class);
    FetchStatsLogger logger = new FetchStatsLogger(activeLogger, aggregateLogger);
    InputAttemptIdentifier ident = new InputAttemptIdentifier(1, 1);
    when(activeLogger.isInfoEnabled()).thenReturn(false);
    for (int i = 0; i < 1000; i++) {
        logger.logIndividualFetchComplete(10, 100, 1000, "testType", ident);
    }
    verify(activeLogger, times(0)).info(anyString());
    verify(aggregateLogger, times(1)).info(anyString(), Matchers.<Object[]>anyVararg());
    when(activeLogger.isInfoEnabled()).thenReturn(true);
    for (int i = 0; i < 1000; i++) {
        logger.logIndividualFetchComplete(10, 100, 1000, "testType", ident);
    }
    verify(activeLogger, times(1000)).info(anyString());
    verify(aggregateLogger, times(1)).info(anyString(), Matchers.<Object[]>anyVararg());
}
Also used : FetchStatsLogger(org.apache.tez.runtime.library.common.shuffle.ShuffleUtils.FetchStatsLogger) InputAttemptIdentifier(org.apache.tez.runtime.library.common.InputAttemptIdentifier) FetchStatsLogger(org.apache.tez.runtime.library.common.shuffle.ShuffleUtils.FetchStatsLogger) Logger(org.slf4j.Logger) Test(org.junit.Test)

Aggregations

InputAttemptIdentifier (org.apache.tez.runtime.library.common.InputAttemptIdentifier)1 FetchStatsLogger (org.apache.tez.runtime.library.common.shuffle.ShuffleUtils.FetchStatsLogger)1 Test (org.junit.Test)1 Logger (org.slf4j.Logger)1