private static TaskState getExternalState(TaskStateInternal smState) { if (smState == TaskStateInternal.KILL_WAIT) { return TaskState.KILLED; } else { return TaskState.valueOf(smState.name()); } }
public void fromProto(TaskFinishedProto proto) { this.taskID = TezTaskID.fromString(proto.getTaskId()); this.finishTime = proto.getFinishTime(); this.state = TaskState.values()[proto.getState()]; if (proto.hasDiagnostics()) { this.diagnostics = proto.getDiagnostics(); } if (proto.hasCounters()) { this.tezCounters = DagTypeConverters.convertTezCountersFromProto(proto.getCounters()); } if (proto.hasSuccessfulTaskAttemptId()) { this.successfulAttemptID = TezTaskAttemptID.fromString(proto.getSuccessfulTaskAttemptId()); } }
public TaskFinishedProto toProto() { TaskFinishedProto.Builder builder = TaskFinishedProto.newBuilder(); builder.setTaskId(taskID.toString()).setState(state.ordinal()).setFinishTime(finishTime); if (diagnostics != null) { builder.setDiagnostics(diagnostics); } if (tezCounters != null) { builder.setCounters(DagTypeConverters.convertTezCountersToProto(tezCounters)); } if (successfulAttemptID != null) { builder.setSuccessfulTaskAttemptId(successfulAttemptID.toString()); } return builder.build(); }
@Override public String toString() { return "vertexName=" + vertexName + ", taskId=" + taskID + ", startTime=" + startTime + ", finishTime=" + finishTime + ", timeTaken=" + (finishTime - startTime) + ", status=" + state.name() + ", successfulAttemptID=" + (successfulAttemptID == null ? "null" : successfulAttemptID.toString()) + ", diagnostics=" + diagnostics + ", counters=" + (tezCounters == null ? "null" : tezCounters.toString().replaceAll("\\n", ", ").replaceAll("\\s+", " ")); }