Java 类org.apache.hadoop.mapreduce.v2.api.records.Counters 实例源码

项目:hadoop    文件:ClientServiceDelegate.java   
public org.apache.hadoop.mapreduce.Counters getJobCounters(JobID arg0) throws IOException,
InterruptedException {
  org.apache.hadoop.mapreduce.v2.api.records.JobId jobID = TypeConverter.toYarn(arg0);
    GetCountersRequest request = recordFactory.newRecordInstance(GetCountersRequest.class);
    request.setJobId(jobID);
    Counters cnt = ((GetCountersResponse)
        invoke("getCounters", GetCountersRequest.class, request)).getCounters();
    return TypeConverter.fromYarn(cnt);

}
项目:hadoop    文件:TestClientServiceDelegate.java   
private GetCountersResponse getCountersResponseFromHistoryServer() {
  GetCountersResponse countersResponse = Records
      .newRecord(GetCountersResponse.class);
  Counter counter = Records.newRecord(Counter.class);
  CounterGroup counterGroup = Records.newRecord(CounterGroup.class);
  Counters counters = Records.newRecord(Counters.class);
  counter.setDisplayName("dummyCounter");
  counter.setName("dummyCounter");
  counter.setValue(1001);
  counterGroup.setName("dummyCounters");
  counterGroup.setDisplayName("dummyCounters");
  counterGroup.setCounter("dummyCounter", counter);
  counters.setCounterGroup("dummyCounters", counterGroup);
  countersResponse.setCounters(counters);
  return countersResponse;
}
项目:hadoop    文件:TestClientRedirect.java   
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");
  group.setCounter("myCounter", counter);

  Counters counters = recordFactory.newRecordInstance(Counters.class);
  counters.setCounterGroup("myGroupd", group);
  return counters;
}
项目:hadoop    文件:TypeConverter.java   
public static org.apache.hadoop.mapreduce.Counters fromYarn(
    Counters yCntrs) {
  if (yCntrs == null) {
    return null;
  }
  org.apache.hadoop.mapreduce.Counters counters =
    new org.apache.hadoop.mapreduce.Counters();
  for (CounterGroup yGrp : yCntrs.getAllCounterGroups().values()) {
    counters.addGroup(yGrp.getName(), yGrp.getDisplayName());
    for (Counter yCntr : yGrp.getAllCounters().values()) {
      org.apache.hadoop.mapreduce.Counter c =
        counters.findCounter(yGrp.getName(),
            yCntr.getName());
      // if c can be found, or it will be skipped.
      if (c != null) {
        c.setValue(yCntr.getValue());
      }
    }
  }
  return counters;
}
项目:hadoop    文件:TypeConverter.java   
public static Counters toYarn(org.apache.hadoop.mapred.Counters counters) {
  if (counters == null) {
    return null;
  }
  Counters yCntrs = recordFactory.newRecordInstance(Counters.class);
  yCntrs.addAllCounterGroups(new HashMap<String, CounterGroup>());
  for (org.apache.hadoop.mapred.Counters.Group 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.mapred.Counters.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;
}
项目:hadoop    文件:TypeConverter.java   
public static Counters toYarn(org.apache.hadoop.mapreduce.Counters counters) {
  if (counters == null) {
    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;
}
项目:aliyun-oss-hadoop-fs    文件:TestClientServiceDelegate.java   
private GetCountersResponse getCountersResponseFromHistoryServer() {
  GetCountersResponse countersResponse = Records
      .newRecord(GetCountersResponse.class);
  Counter counter = Records.newRecord(Counter.class);
  CounterGroup counterGroup = Records.newRecord(CounterGroup.class);
  Counters counters = Records.newRecord(Counters.class);
  counter.setDisplayName("dummyCounter");
  counter.setName("dummyCounter");
  counter.setValue(1001);
  counterGroup.setName("dummyCounters");
  counterGroup.setDisplayName("dummyCounters");
  counterGroup.setCounter("dummyCounter", counter);
  counters.setCounterGroup("dummyCounters", counterGroup);
  countersResponse.setCounters(counters);
  return countersResponse;
}
项目:aliyun-oss-hadoop-fs    文件:TestClientRedirect.java   
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");
  group.setCounter("myCounter", counter);

  Counters counters = recordFactory.newRecordInstance(Counters.class);
  counters.setCounterGroup("myGroupd", group);
  return counters;
}
项目:aliyun-oss-hadoop-fs    文件:TypeConverter.java   
public static org.apache.hadoop.mapreduce.Counters fromYarn(
    Counters yCntrs) {
  if (yCntrs == null) {
    return null;
  }
  org.apache.hadoop.mapreduce.Counters counters =
    new org.apache.hadoop.mapreduce.Counters();
  for (CounterGroup yGrp : yCntrs.getAllCounterGroups().values()) {
    counters.addGroup(yGrp.getName(), yGrp.getDisplayName());
    for (Counter yCntr : yGrp.getAllCounters().values()) {
      org.apache.hadoop.mapreduce.Counter c =
        counters.findCounter(yGrp.getName(),
            yCntr.getName());
      // if c can be found, or it will be skipped.
      if (c != null) {
        c.setValue(yCntr.getValue());
      }
    }
  }
  return counters;
}
项目:aliyun-oss-hadoop-fs    文件:TypeConverter.java   
public static Counters toYarn(org.apache.hadoop.mapred.Counters counters) {
  if (counters == null) {
    return null;
  }
  Counters yCntrs = recordFactory.newRecordInstance(Counters.class);
  yCntrs.addAllCounterGroups(new HashMap<String, CounterGroup>());
  for (org.apache.hadoop.mapred.Counters.Group 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.mapred.Counters.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;
}
项目:aliyun-oss-hadoop-fs    文件:TypeConverter.java   
public static Counters toYarn(org.apache.hadoop.mapreduce.Counters counters) {
  if (counters == null) {
    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;
}
项目:big-c    文件:TestClientServiceDelegate.java   
private GetCountersResponse getCountersResponseFromHistoryServer() {
  GetCountersResponse countersResponse = Records
      .newRecord(GetCountersResponse.class);
  Counter counter = Records.newRecord(Counter.class);
  CounterGroup counterGroup = Records.newRecord(CounterGroup.class);
  Counters counters = Records.newRecord(Counters.class);
  counter.setDisplayName("dummyCounter");
  counter.setName("dummyCounter");
  counter.setValue(1001);
  counterGroup.setName("dummyCounters");
  counterGroup.setDisplayName("dummyCounters");
  counterGroup.setCounter("dummyCounter", counter);
  counters.setCounterGroup("dummyCounters", counterGroup);
  countersResponse.setCounters(counters);
  return countersResponse;
}
项目:big-c    文件:TestClientRedirect.java   
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");
  group.setCounter("myCounter", counter);

  Counters counters = recordFactory.newRecordInstance(Counters.class);
  counters.setCounterGroup("myGroupd", group);
  return counters;
}
项目:big-c    文件:TypeConverter.java   
public static org.apache.hadoop.mapreduce.Counters fromYarn(
    Counters yCntrs) {
  if (yCntrs == null) {
    return null;
  }
  org.apache.hadoop.mapreduce.Counters counters =
    new org.apache.hadoop.mapreduce.Counters();
  for (CounterGroup yGrp : yCntrs.getAllCounterGroups().values()) {
    counters.addGroup(yGrp.getName(), yGrp.getDisplayName());
    for (Counter yCntr : yGrp.getAllCounters().values()) {
      org.apache.hadoop.mapreduce.Counter c =
        counters.findCounter(yGrp.getName(),
            yCntr.getName());
      // if c can be found, or it will be skipped.
      if (c != null) {
        c.setValue(yCntr.getValue());
      }
    }
  }
  return counters;
}
项目:big-c    文件:TypeConverter.java   
public static Counters toYarn(org.apache.hadoop.mapred.Counters counters) {
  if (counters == null) {
    return null;
  }
  Counters yCntrs = recordFactory.newRecordInstance(Counters.class);
  yCntrs.addAllCounterGroups(new HashMap<String, CounterGroup>());
  for (org.apache.hadoop.mapred.Counters.Group 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.mapred.Counters.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;
}
项目:big-c    文件:TypeConverter.java   
public static Counters toYarn(org.apache.hadoop.mapreduce.Counters counters) {
  if (counters == null) {
    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;
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestClientServiceDelegate.java   
private GetCountersResponse getCountersResponseFromHistoryServer() {
  GetCountersResponse countersResponse = Records
      .newRecord(GetCountersResponse.class);
  Counter counter = Records.newRecord(Counter.class);
  CounterGroup counterGroup = Records.newRecord(CounterGroup.class);
  Counters counters = Records.newRecord(Counters.class);
  counter.setDisplayName("dummyCounter");
  counter.setName("dummyCounter");
  counter.setValue(1001);
  counterGroup.setName("dummyCounters");
  counterGroup.setDisplayName("dummyCounters");
  counterGroup.setCounter("dummyCounter", counter);
  counters.setCounterGroup("dummyCounters", counterGroup);
  countersResponse.setCounters(counters);
  return countersResponse;
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestClientRedirect.java   
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");
  group.setCounter("myCounter", counter);

  Counters counters = recordFactory.newRecordInstance(Counters.class);
  counters.setCounterGroup("myGroupd", group);
  return counters;
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TypeConverter.java   
public static org.apache.hadoop.mapreduce.Counters fromYarn(
    Counters yCntrs) {
  if (yCntrs == null) {
    return null;
  }
  org.apache.hadoop.mapreduce.Counters counters =
    new org.apache.hadoop.mapreduce.Counters();
  for (CounterGroup yGrp : yCntrs.getAllCounterGroups().values()) {
    counters.addGroup(yGrp.getName(), yGrp.getDisplayName());
    for (Counter yCntr : yGrp.getAllCounters().values()) {
      org.apache.hadoop.mapreduce.Counter c =
        counters.findCounter(yGrp.getName(),
            yCntr.getName());
      // if c can be found, or it will be skipped.
      if (c != null) {
        c.setValue(yCntr.getValue());
      }
    }
  }
  return counters;
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TypeConverter.java   
public static Counters toYarn(org.apache.hadoop.mapred.Counters counters) {
  if (counters == null) {
    return null;
  }
  Counters yCntrs = recordFactory.newRecordInstance(Counters.class);
  yCntrs.addAllCounterGroups(new HashMap<String, CounterGroup>());
  for (org.apache.hadoop.mapred.Counters.Group 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.mapred.Counters.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;
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TypeConverter.java   
public static Counters toYarn(org.apache.hadoop.mapreduce.Counters counters) {
  if (counters == null) {
    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;
}
项目:hadoop-plus    文件:TestClientServiceDelegate.java   
private GetCountersResponse getCountersResponseFromHistoryServer() {
  GetCountersResponse countersResponse = Records
      .newRecord(GetCountersResponse.class);
  Counter counter = Records.newRecord(Counter.class);
  CounterGroup counterGroup = Records.newRecord(CounterGroup.class);
  Counters counters = Records.newRecord(Counters.class);
  counter.setDisplayName("dummyCounter");
  counter.setName("dummyCounter");
  counter.setValue(1001);
  counterGroup.setName("dummyCounters");
  counterGroup.setDisplayName("dummyCounters");
  counterGroup.setCounter("dummyCounter", counter);
  counters.setCounterGroup("dummyCounters", counterGroup);
  countersResponse.setCounters(counters);
  return countersResponse;
}
项目:hadoop-plus    文件:TestClientRedirect.java   
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");
  group.setCounter("myCounter", counter);

  Counters counters = recordFactory.newRecordInstance(Counters.class);
  counters.setCounterGroup("myGroupd", group);
  return counters;
}
项目:hadoop-plus    文件:TypeConverter.java   
public static org.apache.hadoop.mapreduce.Counters fromYarn(
    Counters yCntrs) {
  if (yCntrs == null) {
    return null;
  }
  org.apache.hadoop.mapreduce.Counters counters =
    new org.apache.hadoop.mapreduce.Counters();
  for (CounterGroup yGrp : yCntrs.getAllCounterGroups().values()) {
    counters.addGroup(yGrp.getName(), yGrp.getDisplayName());
    for (Counter yCntr : yGrp.getAllCounters().values()) {
      org.apache.hadoop.mapreduce.Counter c =
        counters.findCounter(yGrp.getName(),
            yCntr.getName());
      c.setValue(yCntr.getValue());
    }
  }
  return counters;
}
项目:hadoop-plus    文件:TypeConverter.java   
public static Counters toYarn(org.apache.hadoop.mapred.Counters counters) {
  if (counters == null) {
    return null;
  }
  Counters yCntrs = recordFactory.newRecordInstance(Counters.class);
  yCntrs.addAllCounterGroups(new HashMap<String, CounterGroup>());
  for (org.apache.hadoop.mapred.Counters.Group 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.mapred.Counters.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;
}
项目:hadoop-plus    文件:TypeConverter.java   
public static Counters toYarn(org.apache.hadoop.mapreduce.Counters counters) {
  if (counters == null) {
    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;
}
项目:FlexMap    文件:TestClientServiceDelegate.java   
private GetCountersResponse getCountersResponseFromHistoryServer() {
  GetCountersResponse countersResponse = Records
      .newRecord(GetCountersResponse.class);
  Counter counter = Records.newRecord(Counter.class);
  CounterGroup counterGroup = Records.newRecord(CounterGroup.class);
  Counters counters = Records.newRecord(Counters.class);
  counter.setDisplayName("dummyCounter");
  counter.setName("dummyCounter");
  counter.setValue(1001);
  counterGroup.setName("dummyCounters");
  counterGroup.setDisplayName("dummyCounters");
  counterGroup.setCounter("dummyCounter", counter);
  counters.setCounterGroup("dummyCounters", counterGroup);
  countersResponse.setCounters(counters);
  return countersResponse;
}
项目:FlexMap    文件:TestClientRedirect.java   
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");
  group.setCounter("myCounter", counter);

  Counters counters = recordFactory.newRecordInstance(Counters.class);
  counters.setCounterGroup("myGroupd", group);
  return counters;
}
项目:FlexMap    文件:TypeConverter.java   
public static org.apache.hadoop.mapreduce.Counters fromYarn(
    Counters yCntrs) {
  if (yCntrs == null) {
    return null;
  }
  org.apache.hadoop.mapreduce.Counters counters =
    new org.apache.hadoop.mapreduce.Counters();
  for (CounterGroup yGrp : yCntrs.getAllCounterGroups().values()) {
    counters.addGroup(yGrp.getName(), yGrp.getDisplayName());
    for (Counter yCntr : yGrp.getAllCounters().values()) {
      org.apache.hadoop.mapreduce.Counter c =
        counters.findCounter(yGrp.getName(),
            yCntr.getName());
      // if c can be found, or it will be skipped.
      if (c != null) {
        c.setValue(yCntr.getValue());
      }
    }
  }
  return counters;
}
项目:FlexMap    文件:TypeConverter.java   
public static Counters toYarn(org.apache.hadoop.mapred.Counters counters) {
  if (counters == null) {
    return null;
  }
  Counters yCntrs = recordFactory.newRecordInstance(Counters.class);
  yCntrs.addAllCounterGroups(new HashMap<String, CounterGroup>());
  for (org.apache.hadoop.mapred.Counters.Group 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.mapred.Counters.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;
}
项目:FlexMap    文件:TypeConverter.java   
public static Counters toYarn(org.apache.hadoop.mapreduce.Counters counters) {
  if (counters == null) {
    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;
}
项目:hops    文件:TestClientServiceDelegate.java   
private GetCountersResponse getCountersResponseFromHistoryServer() {
  GetCountersResponse countersResponse = Records
      .newRecord(GetCountersResponse.class);
  Counter counter = Records.newRecord(Counter.class);
  CounterGroup counterGroup = Records.newRecord(CounterGroup.class);
  Counters counters = Records.newRecord(Counters.class);
  counter.setDisplayName("dummyCounter");
  counter.setName("dummyCounter");
  counter.setValue(1001);
  counterGroup.setName("dummyCounters");
  counterGroup.setDisplayName("dummyCounters");
  counterGroup.setCounter("dummyCounter", counter);
  counters.setCounterGroup("dummyCounters", counterGroup);
  countersResponse.setCounters(counters);
  return countersResponse;
}
项目:hops    文件:TestClientRedirect.java   
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");
  group.setCounter("myCounter", counter);

  Counters counters = recordFactory.newRecordInstance(Counters.class);
  counters.setCounterGroup("myGroupd", group);
  return counters;
}
项目:hops    文件:TypeConverter.java   
public static org.apache.hadoop.mapreduce.Counters fromYarn(
    Counters yCntrs) {
  if (yCntrs == null) {
    return null;
  }
  org.apache.hadoop.mapreduce.Counters counters =
    new org.apache.hadoop.mapreduce.Counters();
  for (CounterGroup yGrp : yCntrs.getAllCounterGroups().values()) {
    counters.addGroup(yGrp.getName(), yGrp.getDisplayName());
    for (Counter yCntr : yGrp.getAllCounters().values()) {
      org.apache.hadoop.mapreduce.Counter c =
        counters.findCounter(yGrp.getName(),
            yCntr.getName());
      // if c can be found, or it will be skipped.
      if (c != null) {
        c.setValue(yCntr.getValue());
      }
    }
  }
  return counters;
}
项目:hops    文件:TypeConverter.java   
public static Counters toYarn(org.apache.hadoop.mapred.Counters counters) {
  if (counters == null) {
    return null;
  }
  Counters yCntrs = recordFactory.newRecordInstance(Counters.class);
  yCntrs.addAllCounterGroups(new HashMap<String, CounterGroup>());
  for (org.apache.hadoop.mapred.Counters.Group 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.mapred.Counters.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;
}
项目:hops    文件:TypeConverter.java   
public static Counters toYarn(org.apache.hadoop.mapreduce.Counters counters) {
  if (counters == null) {
    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;
}
项目:hadoop-TCP    文件:TestClientServiceDelegate.java   
private GetCountersResponse getCountersResponseFromHistoryServer() {
  GetCountersResponse countersResponse = Records
      .newRecord(GetCountersResponse.class);
  Counter counter = Records.newRecord(Counter.class);
  CounterGroup counterGroup = Records.newRecord(CounterGroup.class);
  Counters counters = Records.newRecord(Counters.class);
  counter.setDisplayName("dummyCounter");
  counter.setName("dummyCounter");
  counter.setValue(1001);
  counterGroup.setName("dummyCounters");
  counterGroup.setDisplayName("dummyCounters");
  counterGroup.setCounter("dummyCounter", counter);
  counters.setCounterGroup("dummyCounters", counterGroup);
  countersResponse.setCounters(counters);
  return countersResponse;
}
项目:hadoop-TCP    文件:TestClientRedirect.java   
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");
  group.setCounter("myCounter", counter);

  Counters counters = recordFactory.newRecordInstance(Counters.class);
  counters.setCounterGroup("myGroupd", group);
  return counters;
}
项目:hadoop-TCP    文件:TypeConverter.java   
public static org.apache.hadoop.mapreduce.Counters fromYarn(
    Counters yCntrs) {
  if (yCntrs == null) {
    return null;
  }
  org.apache.hadoop.mapreduce.Counters counters =
    new org.apache.hadoop.mapreduce.Counters();
  for (CounterGroup yGrp : yCntrs.getAllCounterGroups().values()) {
    counters.addGroup(yGrp.getName(), yGrp.getDisplayName());
    for (Counter yCntr : yGrp.getAllCounters().values()) {
      org.apache.hadoop.mapreduce.Counter c =
        counters.findCounter(yGrp.getName(),
            yCntr.getName());
      c.setValue(yCntr.getValue());
    }
  }
  return counters;
}
项目:hadoop-TCP    文件:TypeConverter.java   
public static Counters toYarn(org.apache.hadoop.mapred.Counters counters) {
  if (counters == null) {
    return null;
  }
  Counters yCntrs = recordFactory.newRecordInstance(Counters.class);
  yCntrs.addAllCounterGroups(new HashMap<String, CounterGroup>());
  for (org.apache.hadoop.mapred.Counters.Group 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.mapred.Counters.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;
}