@Override public void toSummaryProtoStream(OutputStream outputStream) throws IOException { SummaryEventProto.Builder builder = RecoveryProtos.SummaryEventProto.newBuilder() .setDagId(dagID.toString()) .setTimestamp(finishTime) .setEventType(getEventType().ordinal()) .setEventPayload(ByteString.copyFrom(Ints.toByteArray(state.ordinal()))); builder.build().writeDelimitedTo(outputStream); }
public void fromProto(DAGFinishedProto proto) { this.dagID = TezDAGID.fromString(proto.getDagId()); this.finishTime = proto.getFinishTime(); this.state = DAGState.values()[proto.getState()]; if (proto.hasDiagnostics()) { this.diagnostics = proto.getDiagnostics(); } if (proto.hasCounters()) { this.tezCounters = DagTypeConverters.convertTezCountersFromProto(proto.getCounters()); } }
public DAGFinishedProto toProto() { DAGFinishedProto.Builder builder = DAGFinishedProto.newBuilder(); builder.setDagId(dagID.toString()).setState(state.ordinal()).setFinishTime(finishTime); if (diagnostics != null) { builder.setDiagnostics(diagnostics); } if (tezCounters != null) { builder.setCounters(DagTypeConverters.convertTezCountersToProto(tezCounters)); } return builder.build(); }
@Override public String toString() { return "dagId=" + dagID + ", startTime=" + startTime + ", finishTime=" + finishTime + ", timeTaken=" + (finishTime - startTime) + ", status=" + state.name() + ", diagnostics=" + diagnostics + ", counters=" + ((tezCounters == null) ? "null" : (tezCounters.toString().replaceAll("\\n", ", ").replaceAll("\\s+", " "))); }
@Override public void fromSummaryProtoStream(SummaryEventProto proto) throws IOException { this.dagID = TezDAGID.fromString(proto.getDagId()); this.finishTime = proto.getTimestamp(); this.state = DAGState.values()[Ints.fromByteArray(proto.getEventPayload().toByteArray())]; }