org.apache.hadoop.mapreduce.Counter.getDisplayName()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(106)

本文整理了Java中org.apache.hadoop.mapreduce.Counter.getDisplayName()方法的一些代码示例,展示了Counter.getDisplayName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Counter.getDisplayName()方法的具体详情如下:
包路径:org.apache.hadoop.mapreduce.Counter
类名称:Counter
方法名:getDisplayName

Counter.getDisplayName介绍

[英]Get the display name of the counter.
[中]获取计数器的显示名称。

代码示例

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
@Override public void addCounter(Counter counter) {
  addCounter(counter.getName(), counter.getDisplayName(), 0);
}

代码示例来源:origin: linkedin/camus

private void checkIfTooManySkippedMsg(Counters counters) {
 double maxPercentSkippedSchemaNotFound = Double.parseDouble(props.getProperty(ETL_MAX_PERCENT_SKIPPED_SCHEMANOTFOUND,
   ETL_MAX_PERCENT_SKIPPED_SCHEMANOTFOUND_DEFAULT));
 double maxPercentSkippedOther = Double.parseDouble(props.getProperty(ETL_MAX_PERCENT_SKIPPED_OTHER,
   ETL_MAX_PERCENT_SKIPPED_OTHER_DEFAULT));
 long actualSkippedSchemaNotFound = 0;
 long actualSkippedOther = 0;
 long actualDecodeSuccessful = 0;
 for (String groupName : counters.getGroupNames()) {
  if (groupName.equals(EtlRecordReader.KAFKA_MSG.class.getName())) {
   CounterGroup group = counters.getGroup(groupName);
   for (Counter counter : group) {
    if (counter.getDisplayName().equals(EtlRecordReader.KAFKA_MSG.DECODE_SUCCESSFUL.toString())) {
     actualDecodeSuccessful = counter.getValue();
    } else if (counter.getDisplayName().equals(EtlRecordReader.KAFKA_MSG.SKIPPED_SCHEMA_NOT_FOUND.toString())) {
     actualSkippedSchemaNotFound = counter.getValue();
    } else if (counter.getDisplayName().equals(EtlRecordReader.KAFKA_MSG.SKIPPED_OTHER.toString())) {
     actualSkippedOther = counter.getValue();
    }
   }
  }
 }
 checkIfTooManySkippedMsg(maxPercentSkippedSchemaNotFound, actualSkippedSchemaNotFound, actualDecodeSuccessful,
   "schema not found");
 checkIfTooManySkippedMsg(maxPercentSkippedOther, actualSkippedOther, actualDecodeSuccessful, "other");
}

代码示例来源:origin: linkedin/camus

log.info("Group: " + group.getDisplayName());
for (Counter counter : group) {
 log.info(counter.getDisplayName() + ":\t" + counter.getValue());

代码示例来源:origin: org.apache.giraph/giraph-core

/**
 * Get counter display name.
 *
 * @return String Hadoop counter display name.
 */
public String getDisplayName() {
 return counter.getDisplayName();
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-mapreduce-client-core

@Override
public String getDisplayName() {
 return realCounter.getDisplayName();
}

代码示例来源:origin: org.apache.crunch/crunch-core

public String getCounterDisplayName(String groupName, String counterName) {
 if (counters == null) {
  return null;
 }
 return counters.findCounter(groupName, counterName).getDisplayName();
}

代码示例来源:origin: org.apache.crunch/crunch-core

public String getCounterDisplayName(Enum<?> key) {
  if (counters == null) {
   return null;
  }
  return counters.findCounter(key).getDisplayName();
 }
}

代码示例来源:origin: stackoverflow.com

Counters counters = job.getCounters();

for (CounterGroup group : counters) {
   System.out.println("* Counter Group: " + group.getDisplayName() + " (" + group.getName() + ")");
   System.out.println("  number of counters in this group: " + group.size());
   for (Counter counter : group) {
    System.out.println("  - " + counter.getDisplayName() + ": " + counter.getName() + ": "+counter.getValue());
   }
  }

代码示例来源:origin: org.apache.hadoop/hadoop-mapred

public synchronized void incrAllCounters(CounterGroup rightGroup) {
  for(Counter right: rightGroup.counters.values()) {
   Counter left = findCounter(right.getName(), right.getDisplayName());
   left.increment(right.getValue());
  }
 }
}

代码示例来源:origin: com.facebook.hadoop/hadoop-core

public synchronized void incrAllCounters(CounterGroup rightGroup) {
  for(Counter right: rightGroup.counters.values()) {
   Counter left = findCounter(right.getName(), right.getDisplayName());
   left.increment(right.getValue());
  }
 }
}

代码示例来源:origin: io.hops/hadoop-mapreduce-client-core

@Override
public synchronized boolean equals(Object genericRight) {
 if (genericRight instanceof Counter) {
  synchronized (genericRight) {
   Counter right = (Counter) genericRight;
   return getName().equals(right.getName()) &&
       getDisplayName().equals(right.getDisplayName()) &&
       getValue() == right.getValue();
  }
 }
 return false;
}

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

@Override
public synchronized boolean equals(Object genericRight) {
 if (genericRight instanceof Counter) {
  synchronized (genericRight) {
   Counter right = (Counter) genericRight;
   return getName().equals(right.getName()) &&
       getDisplayName().equals(right.getDisplayName()) &&
       getValue() == right.getValue();
  }
 }
 return false;
}

代码示例来源:origin: ch.cern.hadoop/hadoop-mapreduce-client-core

@Override
public synchronized boolean equals(Object genericRight) {
 if (genericRight instanceof Counter) {
  synchronized (genericRight) {
   Counter right = (Counter) genericRight;
   return getName().equals(right.getName()) &&
       getDisplayName().equals(right.getDisplayName()) &&
       getValue() == right.getValue();
  }
 }
 return false;
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-mapreduce-client-core

@Override
public synchronized boolean equals(Object genericRight) {
 if (genericRight instanceof Counter) {
  synchronized (genericRight) {
   Counter right = (Counter) genericRight;
   return getName().equals(right.getName()) &&
       getDisplayName().equals(right.getDisplayName()) &&
       getValue() == right.getValue();
  }
 }
 return false;
}

代码示例来源:origin: io.hops/hadoop-mapreduce-client-core

@Override
 public void incrAllCounters(CounterGroupBase<T> rightGroup) {
  try {
   for (Counter right : rightGroup) {
    Counter left = findCounter(right.getName(), right.getDisplayName());
    left.increment(right.getValue());
   }
  } catch (LimitExceededException e) {
   counters.clear();
   throw e;
  }
 }
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-mapreduce-client-core

@Override
 public void incrAllCounters(CounterGroupBase<T> rightGroup) {
  try {
   for (Counter right : rightGroup) {
    Counter left = findCounter(right.getName(), right.getDisplayName());
    left.increment(right.getValue());
   }
  } catch (LimitExceededException e) {
   counters.clear();
   throw e;
  }
 }
}

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

@Override
 public void incrAllCounters(CounterGroupBase<T> rightGroup) {
  try {
   for (Counter right : rightGroup) {
    Counter left = findCounter(right.getName(), right.getDisplayName());
    left.increment(right.getValue());
   }
  } catch (LimitExceededException e) {
   counters.clear();
   throw e;
  }
 }
}

代码示例来源:origin: ch.cern.hadoop/hadoop-mapreduce-client-core

@Override
 public void incrAllCounters(CounterGroupBase<T> rightGroup) {
  try {
   for (Counter right : rightGroup) {
    Counter left = findCounter(right.getName(), right.getDisplayName());
    left.increment(right.getValue());
   }
  } catch (LimitExceededException e) {
   counters.clear();
   throw e;
  }
 }
}

代码示例来源:origin: ch.cern.hadoop/hadoop-mapreduce-client-jobclient

private void validateCounters(org.apache.hadoop.mapreduce.Counters counters) {
 Iterator<org.apache.hadoop.mapreduce.CounterGroup> it = counters.iterator();
 while (it.hasNext()) {
  org.apache.hadoop.mapreduce.CounterGroup group = it.next();
  LOG.info("Group " + group.getDisplayName());
  Iterator<org.apache.hadoop.mapreduce.Counter> itc = group.iterator();
  while (itc.hasNext()) {
   LOG.info("Counter is " + itc.next().getDisplayName());
  }
 }
 Assert.assertEquals(1, counters.countCounters());
}

代码示例来源:origin: com.linkedin.camus/camus-etl-kafka

private void submitCountersToStatsd(Job job) throws IOException {
 Counters counters = job.getCounters();
 if (getStatsdEnabled(job)) {
  StatsDClient statsd =
    new NonBlockingStatsDClient("Camus", getStatsdHost(job), getStatsdPort(job),
      new String[] { "camus:counters" });
  for (CounterGroup counterGroup : counters) {
   for (Counter counter : counterGroup) {
    statsd.gauge(counterGroup.getDisplayName() + "." + counter.getDisplayName(), counter.getValue());
   }
  }
 }
}

相关文章