static long getCounterValueByGroupName(TezCounters vertexCounters, String groupNamePattern, String counterName) { TezCounter tezCounter = vertexCounters.getGroup(groupNamePattern).findCounter(counterName); return (tezCounter == null) ? 0 : tezCounter.getValue(); }
private long getCounterValueByGroupName(TezCounters counters, String pattern, String counterName) { TezCounter tezCounter = counters.getGroup(pattern).findCounter(counterName); return (tezCounter == null) ? 0 : tezCounter.getValue(); }
static long getCounterValueByGroupName(TezCounters vertexCounters, String groupNamePattern, String counterName) { TezCounter tezCounter = vertexCounters.getGroup(groupNamePattern).findCounter(counterName); return (tezCounter == null) ? 0 : tezCounter.getValue(); }
private long getCounterValueByGroupName(TezCounters counters, String pattern, String counterName) { TezCounter tezCounter = counters.getGroup(pattern).findCounter(counterName); return (tezCounter == null) ? 0 : tezCounter.getValue(); }
private long hiveInputRecordsFromTezCounters(String vertexName, String inputVertexName) { // Get the counters for the input vertex. Set<StatusGetOpts> statusOptions = new HashSet<>(1); statusOptions.add(StatusGetOpts.GET_COUNTERS); VertexStatus inputVertexStatus = vertexStatus(statusOptions, inputVertexName); final TezCounters inputVertexCounters = inputVertexStatus.getVertexCounters(); // eg, group name TaskCounter_Map_7_OUTPUT_Reducer_8, counter name OUTPUT_RECORDS String groupName = formattedName("TaskCounter", inputVertexName, vertexName); String counterName = "OUTPUT_RECORDS"; // Do not create counter if it does not exist - // instead fall back to default behavior for determining input records. TezCounter tezCounter = inputVertexCounters.getGroup(groupName).findCounter(counterName, false); if (tezCounter == null) { return -1; } else { return tezCounter.getValue(); } }
private long hiveInputRecordsFromTezCounters(String vertexName, String inputVertexName) { // Get the counters for the input vertex. Set<StatusGetOpts> statusOptions = new HashSet<>(1); statusOptions.add(StatusGetOpts.GET_COUNTERS); VertexStatus inputVertexStatus = vertexStatus(statusOptions, inputVertexName); final TezCounters inputVertexCounters = inputVertexStatus.getVertexCounters(); // eg, group name TaskCounter_Map_7_OUTPUT_Reducer_8, counter name OUTPUT_RECORDS String groupName = formattedName("TaskCounter", inputVertexName, vertexName); String counterName = "OUTPUT_RECORDS"; // Do not create counter if it does not exist - // instead fall back to default behavior for determining input records. TezCounter tezCounter = inputVertexCounters.getGroup(groupName).findCounter(counterName, false); if (tezCounter == null) { return -1; } else { return tezCounter.getValue(); } }
OperatorStats operatorStats = null; String counterName = Operator.Counter.RECORDS_OUT_OPERATOR.toString() + "_" + operatorId; TezCounter tezCounter = counters.getGroup(groupName).findCounter(counterName, false); if (tezCounter != null) { if (operatorStats == null) {
@Override public org.apache.hadoop.mapred.Counters.Counter findCounter( String counterName, String displayName) { return new MRCounter(group.findCounter(counterName, displayName)); } @Override
private static void addCounter(CounterGroup group, String counterName, String displayName, long counterValue) { try { TezCounter counter = group.findCounter(counterName, displayName); counter.setValue(counterValue); } catch(IllegalArgumentException e) { LOG.debug("Error finding {} in {} with displayName {}", counterName, group, displayName); } }
@Override protected long getCounterValue( TezCounters counterGroups, String groupName, String counterName ) { CounterGroup counterGroup = counterGroups.getGroup( groupName ); if( counterGroup == null ) return 0; TezCounter counterValue = counterGroup.findCounter( counterName ); if( counterValue == null ) return 0; return counterValue.getValue(); }
private static long getCounterValueByGroupName(TezCounters vertexCounters, String groupNamePattern, String counterName) { TezCounter tezCounter = vertexCounters.getGroup(groupNamePattern).findCounter(counterName); return (tezCounter == null) ? 0 : tezCounter.getValue(); }
@Override protected long getCounterValue( TezCounters counterGroups, String groupName, String counterName ) { CounterGroup counterGroup = counterGroups.getGroup( groupName ); if( counterGroup == null ) return 0; TezCounter counterValue = counterGroup.findCounter( counterName ); if( counterValue == null ) return 0; return counterValue.getValue(); }
@Override public boolean incrCounter(String group, String name, long delta) { if (context == null) { return false; } TezCounter counter = context.getCounters().getGroup(group).findCounter(name); counter.increment(delta); return true; } }
@Override public Counter getCounter(String group, String name) { if (context == null) { return null; } TezCounter tezCounter = context.getCounters().getGroup(group).findCounter(name); return new MRCounter(tezCounter); }
@Override public String aggregateStats(String keyPrefix, String statType) { String result; if (delegate) { result = mrAggregator.aggregateStats(keyPrefix, statType); } else { long value = 0; for (String groupName : counters.getGroupNames()) { if (groupName.startsWith(keyPrefix)) { value += counters.getGroup(groupName).findCounter(statType).getValue(); } } result = String.valueOf(value); } LOG.info("Counter based stats for ("+keyPrefix+") are: "+result); return result; }
public static TezCounters convertTezCountersFromProto(TezCountersProto proto) { TezCounters counters = new TezCounters(); for (TezCounterGroupProto counterGroupProto : proto.getCounterGroupsList()) { CounterGroup group = counters.addGroup(counterGroupProto.getName(), counterGroupProto.getDisplayName()); for (TezCounterProto counterProto : counterGroupProto.getCountersList()) { TezCounter counter = group.findCounter( counterProto.getName(), counterProto.getDisplayName()); counter.setValue(counterProto.getValue()); } } return counters; }
totalTasks = (int) dagGrp.findCounter("TOTAL_LAUNCHED_TASKS").getValue(); fileBytesRead = fsGrp.findCounter(PigStatsUtil.FILE_BYTES_READ).getValue(); fileBytesWritten = fsGrp.findCounter(PigStatsUtil.FILE_BYTES_WRITTEN).getValue(); hdfsBytesRead = fsGrp.findCounter(PigStatsUtil.HDFS_BYTES_READ).getValue(); hdfsBytesWritten = fsGrp.findCounter(PigStatsUtil.HDFS_BYTES_WRITTEN).getValue(); } else { LOG.warn("Failed to get counters for DAG: " + dag.getName());