/** {@inheritDoc} */ @Override public synchronized CounterGroup addGroup(CounterGroup grp) { return addGroup(grp.getName(), grp.getDisplayName()); }
/** {@inheritDoc} */ @Override public synchronized void incrAllCounters(AbstractCounters<Counter, CounterGroup> other) { for (CounterGroup group : other) { for (Counter counter : group) { findCounter(group.getName(), counter.getName()).increment(counter.getValue()); } } }
/** Add a group. */ public void addGroup(CounterGroup group) { groups.put(group.getName(), group); }
@Override public JsonElement serialize(org.apache.hadoop.mapreduce.Counters counters, Type type, JsonSerializationContext ctx) { JsonObject obj = new JsonObject(); for (CounterGroup group : counters) { obj.add(group.getName(), ctx.serialize(group)); } return obj; } }
private void setCounters( TaskReport taskReport ) { this.counters = new HashMap<>(); Counters hadoopCounters = taskReport.getTaskCounters(); for( CounterGroup group : hadoopCounters ) { Map<String, Long> values = new HashMap<String, Long>(); this.counters.put( group.getName(), values ); for( Counter counter : group ) values.put( counter.getName(), counter.getValue() ); } }
private void setCounters( TaskReport taskReport ) { this.counters = new HashMap<>(); Counters hadoopCounters = taskReport.getTaskCounters(); for( CounterGroup group : hadoopCounters ) { Map<String, Long> values = new HashMap<String, Long>(); this.counters.put( group.getName(), values ); for( Counter counter : group ) values.put( counter.getName(), counter.getValue() ); } }
/** * Increments multiple counters by their amounts in another Counters * instance. * @param other the other Counters instance */ public synchronized void incrAllCounters(Counters other) { for(Map.Entry<String, CounterGroup> rightEntry: other.groups.entrySet()) { CounterGroup left = groups.get(rightEntry.getKey()); CounterGroup right = rightEntry.getValue(); if (left == null) { left = new CounterGroup(right.getName(), right.getDisplayName()); groups.put(rightEntry.getKey(), left); } left.incrAllCounters(right); } }
public synchronized void setMapReduceCounters(Counters counters) { ImmutableMap.Builder<String, Map<String, Long>> countersBuilder = ImmutableMap.builder(); for (CounterGroup group : counters) { ImmutableMap.Builder<String, Long> groupBuilder = ImmutableMap.builder(); for (Counter counter : group) { groupBuilder.put(counter.getName(), counter.getValue()); // Also put the counter to system scope. put(group.getName() + "." + counter.getName(), Value.of(counter.getValue()), WorkflowToken.Scope.SYSTEM); } countersBuilder.put(group.getName(), groupBuilder.build()); } this.mapReduceCounters = countersBuilder.build(); }
public synchronized void setMapReduceCounters(Counters counters) { ImmutableMap.Builder<String, Map<String, Long>> countersBuilder = ImmutableMap.builder(); for (CounterGroup group : counters) { ImmutableMap.Builder<String, Long> groupBuilder = ImmutableMap.builder(); for (Counter counter : group) { groupBuilder.put(counter.getName(), counter.getValue()); // Also put the counter to system scope. put(group.getName() + "." + counter.getName(), Value.of(counter.getValue()), WorkflowToken.Scope.SYSTEM); } countersBuilder.put(group.getName(), groupBuilder.build()); } this.mapReduceCounters = countersBuilder.build(); }
/** * Increments multiple counters by their amounts in another Counters * instance. * @param other the other Counters instance */ public synchronized void incrAllCounters(Counters other) { for(Map.Entry<String, CounterGroup> rightEntry: other.groups.entrySet()) { CounterGroup left = groups.get(rightEntry.getKey()); CounterGroup right = rightEntry.getValue(); if (left == null) { left = new CounterGroup(right.getName(), right.getDisplayName()); groups.put(rightEntry.getKey(), left); } left.incrAllCounters(right); } }
public JobCounterInfo(AppContext ctx, Job job) { getCounters(ctx, job); counterGroup = new ArrayList<CounterGroupInfo>(); this.id = MRApps.toString(job.getID()); if (total != null) { for (CounterGroup g : total) { if (g != null) { CounterGroup mg = map == null ? null : map.getGroup(g.getName()); CounterGroup rg = reduce == null ? null : reduce .getGroup(g.getName()); CounterGroupInfo cginfo = new CounterGroupInfo(g.getName(), g, mg, rg); counterGroup.add(cginfo); } } } }
public StatsDAspect getAspect(StatsDOutputType type, CounterGroup group, Counter counter) { return getAspect(type, group.getName(), (counter == null ? null : counter.getName())); }
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()); } }
public JobTaskCounterInfo(Task task) { total = task.getCounters(); this.id = MRApps.toString(task.getID()); taskCounterGroup = new ArrayList<TaskCounterGroupInfo>(); if (total != null) { for (CounterGroup g : total) { if (g != null) { TaskCounterGroupInfo cginfo = new TaskCounterGroupInfo(g.getName(), g); taskCounterGroup.add(cginfo); } } } } }
public JobTaskCounterInfo(Task task) { total = task.getCounters(); this.id = MRApps.toString(task.getID()); taskCounterGroup = new ArrayList<TaskCounterGroupInfo>(); if (total != null) { for (CounterGroup g : total) { if (g != null) { TaskCounterGroupInfo cginfo = new TaskCounterGroupInfo(g.getName(), g); taskCounterGroup.add(cginfo); } } } } }
public JobTaskCounterInfo(Task task) { total = task.getCounters(); this.id = MRApps.toString(task.getID()); taskCounterGroup = new ArrayList<TaskCounterGroupInfo>(); if (total != null) { for (CounterGroup g : total) { if (g != null) { TaskCounterGroupInfo cginfo = new TaskCounterGroupInfo(g.getName(), g); taskCounterGroup.add(cginfo); } } } } }
public JobTaskAttemptCounterInfo(TaskAttempt taskattempt) { this.id = MRApps.toString(taskattempt.getID()); total = taskattempt.getCounters(); taskAttemptCounterGroup = new ArrayList<TaskCounterGroupInfo>(); if (total != null) { for (CounterGroup g : total) { if (g != null) { TaskCounterGroupInfo cginfo = new TaskCounterGroupInfo(g.getName(), g); if (cginfo != null) { taskAttemptCounterGroup.add(cginfo); } } } } } }
public JobTaskAttemptCounterInfo(TaskAttempt taskattempt) { this.id = MRApps.toString(taskattempt.getID()); total = taskattempt.getCounters(); taskAttemptCounterGroup = new ArrayList<TaskCounterGroupInfo>(); if (total != null) { for (CounterGroup g : total) { if (g != null) { TaskCounterGroupInfo cginfo = new TaskCounterGroupInfo(g.getName(), g); if (cginfo != null) { taskAttemptCounterGroup.add(cginfo); } } } } } }
public JobTaskAttemptCounterInfo(TaskAttempt taskattempt) { this.id = MRApps.toString(taskattempt.getID()); total = taskattempt.getCounters(); taskAttemptCounterGroup = new ArrayList<TaskCounterGroupInfo>(); if (total != null) { for (CounterGroup g : total) { if (g != null) { TaskCounterGroupInfo cginfo = new TaskCounterGroupInfo(g.getName(), g); if (cginfo != null) { taskAttemptCounterGroup.add(cginfo); } } } } } }
public synchronized void incrAllCounters(Counters other) { for (CounterGroup cg : other) { for (Counter c : cg) { findCounter(cg.getName(), c.getName()).increment(c.getValue()); } } } }