本文整理汇总了Java中org.apache.hadoop.mapreduce.v2.api.records.CounterGroup.setDisplayName方法的典型用法代码示例。如果您正苦于以下问题:Java CounterGroup.setDisplayName方法的具体用法?Java CounterGroup.setDisplayName怎么用?Java CounterGroup.setDisplayName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.mapreduce.v2.api.records.CounterGroup
的用法示例。
在下文中一共展示了CounterGroup.setDisplayName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCountersResponseFromHistoryServer
import org.apache.hadoop.mapreduce.v2.api.records.CounterGroup; //导入方法依赖的package包/类
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;
}
示例2: getMyCounters
import org.apache.hadoop.mapreduce.v2.api.records.CounterGroup; //导入方法依赖的package包/类
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;
}
示例3: toYarn
import org.apache.hadoop.mapreduce.v2.api.records.CounterGroup; //导入方法依赖的package包/类
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;
}
示例4: incrCounter
import org.apache.hadoop.mapreduce.v2.api.records.CounterGroup; //导入方法依赖的package包/类
@Override
public void incrCounter(Enum<?> key, long amount) {
String groupName = key.getDeclaringClass().getName();
if (getCounterGroup(groupName) == null) {
CounterGroup cGrp = new CounterGroupPBImpl();
cGrp.setName(groupName);
cGrp.setDisplayName(groupName);
setCounterGroup(groupName, cGrp);
}
if (getCounterGroup(groupName).getCounter(key.name()) == null) {
Counter c = new CounterPBImpl();
c.setName(key.name());
c.setDisplayName(key.name());
c.setValue(0l);
getCounterGroup(groupName).setCounter(key.name(), c);
}
Counter counter = getCounterGroup(groupName).getCounter(key.name());
counter.setValue(counter.getValue() + amount);
}