Search in sources :

Example 1 with TaskAttemptFinishedProto

use of org.apache.tez.dag.recovery.records.RecoveryProtos.TaskAttemptFinishedProto in project tez by apache.

the class TaskAttemptFinishedEvent method toProto.

public TaskAttemptFinishedProto toProto() throws IOException {
    TaskAttemptFinishedProto.Builder builder = TaskAttemptFinishedProto.newBuilder();
    builder.setTaskAttemptId(taskAttemptId.toString()).setState(state.ordinal()).setCreationTime(creationTime).setAllocationTime(allocationTime).setStartTime(startTime).setFinishTime(finishTime);
    if (taskFailureType != null) {
        builder.setTaskFailureType(TezConverterUtils.failureTypeToProto(taskFailureType));
    }
    if (creationCausalTA != null) {
        builder.setCreationCausalTA(creationCausalTA.toString());
    }
    if (diagnostics != null) {
        builder.setDiagnostics(diagnostics);
    }
    if (error != null) {
        builder.setErrorEnum(error.name());
    }
    if (tezCounters != null) {
        builder.setCounters(DagTypeConverters.convertTezCountersToProto(tezCounters));
    }
    if (dataEvents != null && !dataEvents.isEmpty()) {
        for (DataEventDependencyInfo info : dataEvents) {
            builder.addDataEvents(DataEventDependencyInfo.toProto(info));
        }
    }
    if (taGeneratedEvents != null && !taGeneratedEvents.isEmpty()) {
        for (TezEvent event : taGeneratedEvents) {
            builder.addTaGeneratedEvents(TezEventUtils.toProto(event));
        }
    }
    if (containerId != null) {
        builder.setContainerId(containerId.toString());
    }
    if (nodeId != null) {
        builder.setNodeId(nodeId.toString());
    }
    if (nodeHttpAddress != null) {
        builder.setNodeHttpAddress(nodeHttpAddress);
    }
    return builder.build();
}
Also used : DataEventDependencyInfo(org.apache.tez.dag.app.dag.impl.TaskAttemptImpl.DataEventDependencyInfo) TaskAttemptFinishedProto(org.apache.tez.dag.recovery.records.RecoveryProtos.TaskAttemptFinishedProto) TezEvent(org.apache.tez.runtime.api.impl.TezEvent)

Example 2 with TaskAttemptFinishedProto

use of org.apache.tez.dag.recovery.records.RecoveryProtos.TaskAttemptFinishedProto in project tez by apache.

the class TaskAttemptFinishedEvent method fromProtoStream.

@Override
public void fromProtoStream(InputStream inputStream) throws IOException {
    TaskAttemptFinishedProto proto = TaskAttemptFinishedProto.parseDelimitedFrom(inputStream);
    if (proto == null) {
        throw new IOException("No data found in stream");
    }
    fromProto(proto);
}
Also used : TaskAttemptFinishedProto(org.apache.tez.dag.recovery.records.RecoveryProtos.TaskAttemptFinishedProto) IOException(java.io.IOException)

Aggregations

TaskAttemptFinishedProto (org.apache.tez.dag.recovery.records.RecoveryProtos.TaskAttemptFinishedProto)2 IOException (java.io.IOException)1 DataEventDependencyInfo (org.apache.tez.dag.app.dag.impl.TaskAttemptImpl.DataEventDependencyInfo)1 TezEvent (org.apache.tez.runtime.api.impl.TezEvent)1