Search in sources :

Example 1 with TezCountersProto

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();
}
Also used : TezCounterGroupProto(org.apache.tez.dag.api.records.DAGProtos.TezCounterGroupProto) TezCounterProto(org.apache.tez.dag.api.records.DAGProtos.TezCounterProto) TezCountersProto(org.apache.tez.dag.api.records.DAGProtos.TezCountersProto) CounterGroup(org.apache.tez.common.counters.CounterGroup) TezCounter(org.apache.tez.common.counters.TezCounter) PlanTaskLocationHint(org.apache.tez.dag.api.records.DAGProtos.PlanTaskLocationHint)

Example 2 with TezCountersProto

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();
}
Also used : ProgressProto(org.apache.tez.dag.api.records.DAGProtos.ProgressProto) TezCountersProto(org.apache.tez.dag.api.records.DAGProtos.TezCountersProto)

Aggregations

TezCountersProto (org.apache.tez.dag.api.records.DAGProtos.TezCountersProto)2 CounterGroup (org.apache.tez.common.counters.CounterGroup)1 TezCounter (org.apache.tez.common.counters.TezCounter)1 PlanTaskLocationHint (org.apache.tez.dag.api.records.DAGProtos.PlanTaskLocationHint)1 ProgressProto (org.apache.tez.dag.api.records.DAGProtos.ProgressProto)1 TezCounterGroupProto (org.apache.tez.dag.api.records.DAGProtos.TezCounterGroupProto)1 TezCounterProto (org.apache.tez.dag.api.records.DAGProtos.TezCounterProto)1