use of org.apache.tez.dag.api.records.DAGProtos.TezCountersProto in project tez by apache.
the class DagTypeConverters method convertTezCountersToProto.
public static TezCountersProto convertTezCountersToProto(TezCounters counters) {
TezCountersProto.Builder builder = TezCountersProto.newBuilder();
Iterator<CounterGroup> groupIterator = counters.iterator();
int groupIndex = 0;
while (groupIterator.hasNext()) {
CounterGroup counterGroup = groupIterator.next();
TezCounterGroupProto.Builder groupBuilder = TezCounterGroupProto.newBuilder();
groupBuilder.setName(counterGroup.getName());
groupBuilder.setDisplayName(counterGroup.getDisplayName());
Iterator<TezCounter> counterIterator = counterGroup.iterator();
int counterIndex = 0;
while (counterIterator.hasNext()) {
TezCounter counter = counterIterator.next();
TezCounterProto tezCounterProto = TezCounterProto.newBuilder().setName(counter.getName()).setDisplayName(counter.getDisplayName()).setValue(counter.getValue()).build();
groupBuilder.addCounters(counterIndex, tezCounterProto);
++counterIndex;
}
builder.addCounterGroups(groupIndex, groupBuilder.build());
++groupIndex;
}
return builder.build();
}
use of org.apache.tez.dag.api.records.DAGProtos.TezCountersProto in project tez by apache.
the class TestDAGClient method setUpData.
private void setUpData() {
// DAG
ProgressProto dagProgressProto = ProgressProto.newBuilder().setFailedTaskCount(1).setKilledTaskCount(1).setRunningTaskCount(2).setSucceededTaskCount(2).setTotalTaskCount(6).build();
TezCountersProto dagCountersProto = TezCountersProto.newBuilder().addCounterGroups(TezCounterGroupProto.newBuilder().setName("DAGGroup").addCounters(TezCounterProto.newBuilder().setDisplayName("dag_counter_1").setValue(99))).build();
dagStatusProtoWithoutCounters = DAGStatusProto.newBuilder().addDiagnostics("Diagnostics_0").setState(DAGStatusStateProto.DAG_RUNNING).setDAGProgress(dagProgressProto).addVertexProgress(StringProgressPairProto.newBuilder().setKey("v1").setProgress(ProgressProto.newBuilder().setFailedTaskCount(0).setSucceededTaskCount(0).setKilledTaskCount(0))).addVertexProgress(StringProgressPairProto.newBuilder().setKey("v2").setProgress(ProgressProto.newBuilder().setFailedTaskCount(1).setSucceededTaskCount(1).setKilledTaskCount(1))).build();
dagStatusProtoWithCounters = DAGStatusProto.newBuilder(dagStatusProtoWithoutCounters).setDagCounters(dagCountersProto).build();
// Vertex
ProgressProto vertexProgressProto = ProgressProto.newBuilder().setFailedTaskCount(1).setKilledTaskCount(0).setRunningTaskCount(0).setSucceededTaskCount(1).build();
TezCountersProto vertexCountersProto = TezCountersProto.newBuilder().addCounterGroups(TezCounterGroupProto.newBuilder().addCounters(TezCounterProto.newBuilder().setDisplayName("vertex_counter_1").setValue(99))).build();
vertexStatusProtoWithoutCounters = VertexStatusProto.newBuilder().addDiagnostics("V_Diagnostics_0").setProgress(vertexProgressProto).setState(// make sure the waitForCompletion be able to finish
VertexStatusStateProto.VERTEX_SUCCEEDED).build();
vertexStatusProtoWithCounters = VertexStatusProto.newBuilder(vertexStatusProtoWithoutCounters).setVertexCounters(vertexCountersProto).build();
}
Aggregations