Examples of COUNTER


Examples of org.apache.hadoop.mapreduce.Counter

    values.add(hihoValue1);
    values.add(hihoValue2);

    Reducer.Context context = mock(Reducer.Context.class);
    Counters counters = new Counters();
    Counter counter = counters.findCounter(MergeRecordCounter.OUTPUT);
    when(context.getCounter(MergeRecordCounter.OUTPUT)).thenReturn(counter);
    MergeKeyReducer mergeReducer = new MergeKeyReducer();
    mergeReducer.reduce(hihoTuple, values, context);
    verify(context).write(key, value2);
    assertEquals(1, context.getCounter(MergeRecordCounter.OUTPUT)
View Full Code Here

Examples of org.apache.hadoop.mapreduce.Counter

    values.add(hihoValue1);
    values.add(hihoValue2);

    Reducer.Context context = mock(Reducer.Context.class);
    Counters counters = new Counters();
    Counter counter = counters.findCounter(MergeRecordCounter.OUTPUT);
    when(context.getCounter(MergeRecordCounter.OUTPUT)).thenReturn(counter);
    MergeKeyReducer mergeReducer = new MergeKeyReducer();
    mergeReducer.reduce(hihoTuple, values, context);
    verify(context).write(key, value2);
    assertEquals(1, context.getCounter(MergeRecordCounter.OUTPUT)
View Full Code Here

Examples of org.apache.hadoop.mapreduce.Counter

    if (counters == null) {
      return;
    }

    // TODO: remove deprecation suppress when we don't want to rely on org.apache.hadoop.mapred
    Counter count = counters.findCounter(Task.Counter.MAP_INPUT_RECORDS);

    for (int i = 0; i < safeLongToInt(count.getValue()); i++) {
      contribution.incrementReadCount();
    }

    count = counters.findCounter(Task.Counter.MAP_SKIPPED_RECORDS);
    contribution.incrementReadSkipCount(safeLongToInt(count.getValue()));

    count = counters.findCounter(Task.Counter.REDUCE_OUTPUT_RECORDS);
    contribution.incrementWriteCount(safeLongToInt(count.getValue()));

    count = counters.findCounter(Task.Counter.REDUCE_SKIPPED_RECORDS);

    for (int i = 0; i < safeLongToInt(count.getValue()); i++) {
      contribution.incrementWriteSkipCount();
    }
  }
View Full Code Here

Examples of org.apache.hadoop.mapreduce.Counter

    try {
      for (String cgName : job.getCounters().getGroupNames()) {
        CounterGroup group = job.getCounters().getGroup(cgName);
        Iterator<Counter> ci = group.iterator();
        while (ci.hasNext()) {
          Counter c = ci.next();
          executionContext.put(group.getDisplayName().trim() + "::" + c.getDisplayName().trim(), c.getValue());
        }
      }
    } catch (Exception ignore) {}
  }
View Full Code Here

Examples of org.apache.hadoop.mapreduce.Counter

    // the system will produce individual mocks for each counter so we can watch what
    // happens with counters
    //

    private void incrementCounter(Context context,Enum <?> counterId,long amount) {
        Counter counter=context.getCounter(counterId);
        if(counter!=null) {
            counter.increment(amount);
        };
    };
View Full Code Here

Examples of org.apache.hadoop.mapreduce.Counter

    // the system will produce individual mocks for each counter so we can watch what
    // happens with counters
    //
   
    private void incrementCounter(Context context,Enum <?> counterId,long amount) {
        Counter counter=context.getCounter(counterId);
        if(counter!=null) {
            counter.increment(amount);
        };
    };
View Full Code Here

Examples of org.apache.hadoop.mapreduce.Counter

    // the system will produce individual mocks for each counter so we can watch what
    // happens with counters
    //

    private void incrementCounter(Context context,Enum <?> counterId,long amount) {
        Counter counter=context.getCounter(counterId);
        if(counter!=null) {
            counter.increment(amount);
        };
    };
View Full Code Here

Examples of org.apache.hadoop.mapreduce.v2.api.records.Counter

      return null;
    }
  }

  static Counters getMyCounters() {
    Counter counter = recordFactory.newRecordInstance(Counter.class);
    counter.setName("Mycounter");
    counter.setDisplayName("My counter display name");
    counter.setValue(12345);

    CounterGroup group = recordFactory
        .newRecordInstance(CounterGroup.class);
    group.setName("MyGroup");
    group.setDisplayName("My groupd display name");
View Full Code Here

Examples of org.apache.lucene.util.Counter

* tests basic {@link IntBlockPool} functionality
*/
public class TestIntBlockPool extends LuceneTestCase {
 
  public void testSingleWriterReader() {
    Counter bytesUsed = Counter.newCounter();
    IntBlockPool pool = new IntBlockPool(new ByteTrackingAllocator(bytesUsed));
   
    for (int j = 0; j < 2; j++) {
      IntBlockPool.SliceWriter writer = new IntBlockPool.SliceWriter(pool);
      int start = writer.startNewSlice();
      int num = atLeast(100);
      for (int i = 0; i < num; i++) {
        writer.writeInt(i);
      }
     
      int upto = writer.getCurrentOffset();
      IntBlockPool.SliceReader reader = new IntBlockPool.SliceReader(pool);
      reader.reset(start, upto);
      for (int i = 0; i < num; i++) {
        assertEquals(i, reader.readInt());
      }
      assertTrue(reader.endOfSlice());
      if (random().nextBoolean()) {
        pool.reset(true, false);
        assertEquals(0, bytesUsed.get());
      } else {
        pool.reset(true, true);
        assertEquals(IntBlockPool.INT_BLOCK_SIZE
            * RamUsageEstimator.NUM_BYTES_INT, bytesUsed.get());
      }
    }
  }
View Full Code Here

Examples of org.apache.niolex.commons.test.Counter

    }

    public static void test() throws InterruptedException {
        hashMap = new HashMap<Integer, Counter>();
        for (int i = 0; i < locksNum; ++i) {
            hashMap.put(i, new Counter());
        }
        long tt = 0;
        for (int i = 0; i < 20; ++i) {
            tt += main();
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.