Examples of CounterGroup


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

      return null;
    }
    Counters yCntrs = recordFactory.newRecordInstance(Counters.class);
    yCntrs.addAllCounterGroups(new HashMap<String, CounterGroup>());
    for (org.apache.hadoop.mapreduce.CounterGroup grp : counters) {
      CounterGroup yGrp = recordFactory.newRecordInstance(CounterGroup.class);
      yGrp.setName(grp.getName());
      yGrp.setDisplayName(grp.getDisplayName());
      yGrp.addAllCounters(new HashMap<String, Counter>());
      for (org.apache.hadoop.mapreduce.Counter cntr : grp) {
        Counter yCntr = recordFactory.newRecordInstance(Counter.class);
        yCntr.setName(cntr.getName());
        yCntr.setDisplayName(cntr.getDisplayName());
        yCntr.setValue(cntr.getValue());
        yGrp.setCounter(yCntr.getName(), yCntr);
      }
      yCntrs.setCounterGroup(yGrp.getName(), yGrp);
    }
    return yCntrs;
  }
View Full Code Here

Examples of org.apache.sqoop.submission.counter.CounterGroup

      while(rs.next()) {
        String groupName = rs.getString(1);
        String counterName = rs.getString(2);
        long value = rs.getLong(3);

        CounterGroup group = counters.getCounterGroup(groupName);
        if(group == null) {
          group = new CounterGroup(groupName);
          counters.addCounterGroup(group);
        }

        group.addCounter(new Counter(counterName, value));
      }

      if(counters.isEmpty()) {
        return null;
      } else {
View Full Code Here

Examples of org.apache.sqoop.submission.counter.CounterGroup

    if(hadoopCounters == null) {
      return sqoopCounters;
    }

    for(org.apache.hadoop.mapred.Counters.Group hadoopGroup : hadoopCounters) {
      CounterGroup sqoopGroup = new CounterGroup(hadoopGroup.getName());
      for(org.apache.hadoop.mapred.Counters.Counter hadoopCounter : hadoopGroup) {
        Counter sqoopCounter = new Counter(hadoopCounter.getName(), hadoopCounter.getValue());
        sqoopGroup.addCounter(sqoopCounter);
      }
      sqoopCounters.addCounterGroup(sqoopGroup);
    }

    return sqoopCounters;
View Full Code Here

Examples of org.apache.sqoop.submission.counter.CounterGroup

    Set<Map.Entry<String, JSONObject>> groupSet = object.entrySet();
    Counters counters = new Counters();

    for(Map.Entry<String, JSONObject> groupEntry: groupSet) {

      CounterGroup group = new CounterGroup(groupEntry.getKey());

      Set<Map.Entry<String, Long>> counterSet = groupEntry.getValue().entrySet();

      for(Map.Entry<String, Long> counterEntry: counterSet) {
        Counter counter = new Counter(counterEntry.getKey(), counterEntry.getValue());
        group.addCounter(counter);
      }

      counters.addCounterGroup(group);
    }
View Full Code Here

Examples of org.apache.sqoop.submission.counter.CounterGroup

    assertEquals(99.9, targets.get(1).getProgress());
  }

  public void testTransferCounters() {
    Counters counters = new Counters();
    counters.addCounterGroup(new CounterGroup("A")
      .addCounter(new Counter("X", 1))
      .addCounter(new Counter("Y", 2))
    );
    counters.addCounterGroup(new CounterGroup("B")
      .addCounter(new Counter("XX", 11))
      .addCounter(new Counter("YY", 22))
    );

    MSubmission source = new MSubmission();
    source.setCounters(counters);

    Counters target;
    CounterGroup group;
    Counter counter;

    target = transfer(source).getCounters();
    group = target.getCounterGroup("A");
    assertNotNull(group);
    counter = group.getCounter("X");
    assertNotNull(counter);
    assertEquals(1, counter.getValue());
    counter = group.getCounter("Y");
    assertNotNull(counter);
    assertEquals(2, counter.getValue());

    target = transfer(source).getCounters();
    group = target.getCounterGroup("B");
    assertNotNull(group);
    counter = group.getCounter("XX");
    assertNotNull(counter);
    assertEquals(11, counter.getValue());
    counter = group.getCounter("YY");
    assertNotNull(counter);
    assertEquals(22, counter.getValue());

    Counters countersx = new Counters();
    countersx.addCounterGroup(new CounterGroup("C")
      .addCounter(new Counter("XXX", 111))
      .addCounter(new Counter("YYY", 222))
    );
    countersx.addCounterGroup(new CounterGroup("D")
      .addCounter(new Counter("XXXX", 1111))
      .addCounter(new Counter("YYYY", 2222))
    );

    Counters countersy = new Counters();
    countersy.addCounterGroup(new CounterGroup("E")
      .addCounter(new Counter("XXXXX", 11111))
      .addCounter(new Counter("YYYYY", 22222))
    );
    countersy.addCounterGroup(new CounterGroup("F")
      .addCounter(new Counter("XXXXXX", 111111))
      .addCounter(new Counter("YYYYYY", 222222))
    );

    List<MSubmission> sources = new ArrayList<MSubmission>();
    MSubmission sourcex = new MSubmission();
    sourcex.setCounters(countersx);
    sources.add(sourcex);
    MSubmission sourcey = new MSubmission();
    sourcey.setCounters(countersy);
    sources.add(sourcey);

    List<MSubmission> targets = transfer(sources);
    assertNotNull(targets.get(0));
    target = targets.get(0).getCounters();
    group = target.getCounterGroup("C");
    assertNotNull(group);
    counter = group.getCounter("XXX");
    assertNotNull(counter);
    assertEquals(111, counter.getValue());
    counter = group.getCounter("YYY");
    assertNotNull(counter);
    assertEquals(222, counter.getValue());

    group = target.getCounterGroup("D");
    assertNotNull(group);
    counter = group.getCounter("XXXX");
    assertNotNull(counter);
    assertEquals(1111, counter.getValue());
    counter = group.getCounter("YYYY");
    assertNotNull(counter);
    assertEquals(2222, counter.getValue());

    assertNotNull(targets.get(1));
    target = targets.get(1).getCounters();
    group = target.getCounterGroup("E");
    assertNotNull(group);
    counter = group.getCounter("XXXXX");
    assertNotNull(counter);
    assertEquals(11111, counter.getValue());
    counter = group.getCounter("YYYYY");
    assertNotNull(counter);
    assertEquals(22222, counter.getValue());

    group = target.getCounterGroup("F");
    assertNotNull(group);
    counter = group.getCounter("XXXXXX");
    assertNotNull(counter);
    assertEquals(111111, counter.getValue());
    counter = group.getCounter("YYYYYY");
    assertNotNull(counter);
    assertEquals(222222, counter.getValue());
  }
View Full Code Here

Examples of org.apache.sqoop.submission.counter.CounterGroup

      while(rs.next()) {
        String groupName = rs.getString(1);
        String counterName = rs.getString(2);
        long value = rs.getLong(3);

        CounterGroup group = counters.getCounterGroup(groupName);
        if(group == null) {
          group = new CounterGroup(groupName);
          counters.addCounterGroup(group);
        }

        group.addCounter(new Counter(counterName, value));
      }

      if(counters.isEmpty()) {
        return null;
      } else {
View Full Code Here

Examples of org.apache.sqoop.submission.counter.CounterGroup

    assertEquals(25.0, target.getProgress());
  }

  public void testTransferCounters() {
    Counters counters = new Counters();
    counters.addCounterGroup(new CounterGroup("A")
      .addCounter(new Counter("X", 1))
      .addCounter(new Counter("Y", 2))
    );
    counters.addCounterGroup(new CounterGroup("B")
      .addCounter(new Counter("XX", 11))
      .addCounter(new Counter("YY", 22))
    );

    MSubmission source = new MSubmission();
    source.setCounters(counters);

    Counters target;
    CounterGroup group;
    Counter counter;

    target = transfer(source).getCounters();
    group = target.getCounterGroup("A");
    assertNotNull(group);
    counter = group.getCounter("X");
    assertNotNull(counter);
    assertEquals(1, counter.getValue());
    counter = group.getCounter("Y");
    assertNotNull(counter);
    assertEquals(2, counter.getValue());

    target = transfer(source).getCounters();
    group = target.getCounterGroup("B");
    assertNotNull(group);
    counter = group.getCounter("XX");
    assertNotNull(counter);
    assertEquals(11, counter.getValue());
    counter = group.getCounter("YY");
    assertNotNull(counter);
    assertEquals(22, counter.getValue());
  }
View Full Code Here

Examples of org.apache.sqoop.submission.counter.CounterGroup

    Set<Map.Entry<String, JSONObject>> groupSet = object.entrySet();
    Counters counters = new Counters();

    for(Map.Entry<String, JSONObject> groupEntry: groupSet) {

      CounterGroup group = new CounterGroup(groupEntry.getKey());

      Set<Map.Entry<String, Long>> counterSet = groupEntry.getValue().entrySet();

      for(Map.Entry<String, Long> counterEntry: counterSet) {
        Counter counter = new Counter(counterEntry.getKey(), counterEntry.getValue());
        group.addCounter(counter);
      }

      counters.addCounterGroup(group);
    }
View Full Code Here

Examples of org.apache.tez.common.counters.CounterGroup

        TezCounters tezCounters = tezJob.getDAGCounters();
        if (tezCounters != null) {
            counters = covertToHadoopCounters(tezCounters);
        }

        CounterGroup dagGrp = tezCounters.getGroup(DAG_COUNTER_GROUP);
        totalTasks = (int) dagGrp.findCounter("TOTAL_LAUNCHED_TASKS").getValue();

        CounterGroup fsGrp = tezCounters.getGroup(FS_COUNTER_GROUP);
        fileBytesRead = fsGrp.findCounter("FILE_BYTES_READ").getValue();
        fileBytesWritten = fsGrp.findCounter("FILE_BYTES_WRITTEN").getValue();
        hdfsBytesRead = fsGrp.findCounter("HDFS_BYTES_READ").getValue();
        hdfsBytesWritten = fsGrp.findCounter("HDFS_BYTES_WRITTEN").getValue();

        for (Entry<String, TezVertexStats> entry : tezVertexStatsMap.entrySet()) {
            Vertex v = dag.getVertex(entry.getKey());
            if (v != null && tezVertexStatsMap.containsKey(v.getName())) {
                TezVertexStats vertexStats = entry.getValue();
View Full Code Here

Examples of org.apache.tez.common.counters.CounterGroup

            }
            TezCounters tezCounters = status.getVertexCounters();
            counters = Maps.newHashMap();
            Iterator<CounterGroup> grpIt = tezCounters.iterator();
            while (grpIt.hasNext()) {
                CounterGroup grp = grpIt.next();
                Iterator<TezCounter> cntIt = grp.iterator();
                Map<String, Long> cntMap = Maps.newHashMap();
                while (cntIt.hasNext()) {
                    TezCounter cnt = cntIt.next();
                    cntMap.put(cnt.getName(), cnt.getValue());
                }
                counters.put(grp.getName(), cntMap);
            }

            if (counters.get(FS_COUNTER_GROUP) != null &&
                    counters.get(FS_COUNTER_GROUP).get(PigStatsUtil.HDFS_BYTES_READ) != null) {
                hdfsBytesRead = counters.get(FS_COUNTER_GROUP).get(PigStatsUtil.HDFS_BYTES_READ);
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.