private JobHistory.ReduceAttempt getReduceAttempt( String jobid, String jobTrackerId, String taskId, String taskAttemptId) { JobHistory.Task task = getTask(taskId); JobHistory.ReduceAttempt reduceAttempt = (JobHistory.ReduceAttempt) task.getTaskAttempts().get(taskAttemptId); if (null == reduceAttempt) { reduceAttempt = new JobHistory.ReduceAttempt(); reduceAttempt.set(Keys.TASK_ATTEMPT_ID, taskAttemptId); task.getTaskAttempts().put(taskAttemptId, reduceAttempt); } return reduceAttempt; }
ReduceAttempt reduceAttempt = (ReduceAttempt)attempt; taskList.append(StringUtils.getFormattedTimeWithDiff(dateFormat, reduceAttempt.getLong(Keys.SHUFFLE_FINISHED), reduceAttempt.getLong(Keys.START_TIME))); taskList.append("\t"); taskList.append(StringUtils.getFormattedTimeWithDiff(dateFormat, reduceAttempt.getLong(Keys.SORT_FINISHED), reduceAttempt.getLong(Keys.SHUFFLE_FINISHED)));
public void handle(JobHistory.RecordTypes recType, Map<Keys, String> values) throws IOException { String jobTrackerId = values.get(JobHistory.Keys.JOBTRACKERID); String jobid = values.get(Keys.JOBID); if (recType == JobHistory.RecordTypes.Job) { job.handle(values); }if (recType.equals(JobHistory.RecordTypes.Task)) { String taskid = values.get(JobHistory.Keys.TASKID); getTask(taskid).handle(values); } else if (recType.equals(JobHistory.RecordTypes.MapAttempt)) { String taskid = values.get(Keys.TASKID); String mapAttemptId = values.get(Keys.TASK_ATTEMPT_ID); getMapAttempt(jobid, jobTrackerId, taskid, mapAttemptId).handle(values); } else if (recType.equals(JobHistory.RecordTypes.ReduceAttempt)) { String taskid = values.get(Keys.TASKID); String reduceAttemptId = values.get(Keys.TASK_ATTEMPT_ID); getReduceAttempt(jobid, jobTrackerId, taskid, reduceAttemptId).handle(values); } } }
JobHistory.ReduceAttempt.logStarted(taskid, startTime, taskTrackerName, taskTrackerPort, taskType); if (taskStatus.getRunState() == TaskStatus.State.FAILED) { JobHistory.ReduceAttempt.logFailed(taskid, finishTime, taskTrackerHostName, diagInfo, taskType); } else { JobHistory.ReduceAttempt.logKilled(taskid, finishTime, taskTrackerHostName, diagInfo, taskType);
status.getCounters()); }else{ JobHistory.ReduceAttempt.logStarted( status.getTaskID(), status.getStartTime(), status.getTaskTracker(), ttStatus.getHttpPort(), taskType); JobHistory.ReduceAttempt.logFinished(status.getTaskID(), status.getShuffleFinishTime(), status.getSortFinishTime(), status.getFinishTime(), trackerHostname,
JobHistory.ReduceAttempt.logStarted(taskid, startTime, taskTrackerName, taskTrackerPort, taskType); if (taskStatus.getRunState() == TaskStatus.State.FAILED) { JobHistory.ReduceAttempt.logFailed(taskid, finishTime, taskTrackerHostName, diagInfo, taskType); } else { JobHistory.ReduceAttempt.logKilled(taskid, finishTime, taskTrackerHostName, diagInfo, taskType);
status.getCounters()); }else{ JobHistory.ReduceAttempt.logStarted( status.getTaskID(), status.getStartTime(), status.getTaskTracker(), ttStatus.getHttpPort(), taskType); JobHistory.ReduceAttempt.logFinished(status.getTaskID(), status.getShuffleFinishTime(), status.getSortFinishTime(), status.getFinishTime(), trackerHostname,
JobHistory.ReduceAttempt attempt = new JobHistory.ReduceAttempt(); attempt.handle(values);
ReduceAttempt reduceAttempt = (ReduceAttempt)attempt; taskList.append(StringUtils.getFormattedTimeWithDiff(dateFormat, reduceAttempt.getLong(Keys.SHUFFLE_FINISHED), reduceAttempt.getLong(Keys.START_TIME))); taskList.append("\t"); taskList.append(StringUtils.getFormattedTimeWithDiff(dateFormat, reduceAttempt.getLong(Keys.SORT_FINISHED), reduceAttempt.getLong(Keys.SHUFFLE_FINISHED)));
public void handle(JobHistory.RecordTypes recType, Map<Keys, String> values) throws IOException { String jobTrackerId = values.get(JobHistory.Keys.JOBTRACKERID); String jobid = values.get(Keys.JOBID); if (recType == JobHistory.RecordTypes.Job) { job.handle(values); }if (recType.equals(JobHistory.RecordTypes.Task)) { String taskid = values.get(JobHistory.Keys.TASKID); getTask(taskid).handle(values); } else if (recType.equals(JobHistory.RecordTypes.MapAttempt)) { String taskid = values.get(Keys.TASKID); String mapAttemptId = values.get(Keys.TASK_ATTEMPT_ID); getMapAttempt(jobid, jobTrackerId, taskid, mapAttemptId).handle(values); } else if (recType.equals(JobHistory.RecordTypes.ReduceAttempt)) { String taskid = values.get(Keys.TASKID); String reduceAttemptId = values.get(Keys.TASK_ATTEMPT_ID); getReduceAttempt(jobid, jobTrackerId, taskid, reduceAttemptId).handle(values); } } }
/** * Log finished event of this task. * @param taskAttemptId task attempt id * @param shuffleFinished shuffle finish time * @param sortFinished sort finish time * @param finishTime finish time of task * @param hostName host name where task attempt executed * @deprecated Use * {@link #logFinished(TaskAttemptID, long, long, long, String, String, String, Counters)} */ @Deprecated public static void logFinished(TaskAttemptID taskAttemptId, long shuffleFinished, long sortFinished, long finishTime, String hostName){ logFinished(taskAttemptId, shuffleFinished, sortFinished, finishTime, hostName, Values.REDUCE.name(), "", new Counters()); }
/** * Log finished event of this task. * @param taskAttemptId task attempt id * @param shuffleFinished shuffle finish time * @param sortFinished sort finish time * @param finishTime finish time of task * @param hostName host name where task attempt executed * @deprecated Use * {@link #logFinished(TaskAttemptID, long, long, long, String, String, String, Counters)} */ @Deprecated public static void logFinished(TaskAttemptID taskAttemptId, long shuffleFinished, long sortFinished, long finishTime, String hostName){ logFinished(taskAttemptId, shuffleFinished, sortFinished, finishTime, hostName, Values.REDUCE.name(), "", new Counters()); }
/** * Log failed reduce task attempt. * @param taskAttemptId task attempt id * @param timestamp time stamp when task failed * @param hostName host name of the task attempt. * @param error error message of the task. * @deprecated Use * {@link #logFailed(TaskAttemptID, long, String, String, String)} */ @Deprecated public static void logFailed(TaskAttemptID taskAttemptId, long timestamp, String hostName, String error){ logFailed(taskAttemptId, timestamp, hostName, error, Values.REDUCE.name()); }
/** * Log start time of Reduce task attempt. * @param taskAttemptId task attempt id * @param startTime start time * @param hostName host name * @deprecated Use * {@link #logStarted(TaskAttemptID, long, String, int, String)} */ @Deprecated public static void logStarted(TaskAttemptID taskAttemptId, long startTime, String hostName){ logStarted(taskAttemptId, startTime, hostName, -1, Values.REDUCE.name()); }
/** * Log start time of Reduce task attempt. * @param taskAttemptId task attempt id * @param startTime start time * @param hostName host name * @deprecated Use * {@link #logStarted(TaskAttemptID, long, String, int, String)} */ @Deprecated public static void logStarted(TaskAttemptID taskAttemptId, long startTime, String hostName){ logStarted(taskAttemptId, startTime, hostName, -1, Values.REDUCE.name()); }
/** * Log killed reduce task attempt. * @param taskAttemptId task attempt id * @param timestamp time stamp when task failed * @param hostName host name of the task attempt. * @param error error message of the task. * @deprecated Use * {@link #logKilled(TaskAttemptID, long, String, String, String)} */ @Deprecated public static void logKilled(TaskAttemptID taskAttemptId, long timestamp, String hostName, String error) { logKilled(taskAttemptId, timestamp, hostName, error, Values.REDUCE.name()); }
/** * Log killed reduce task attempt. * @param taskAttemptId task attempt id * @param timestamp time stamp when task failed * @param hostName host name of the task attempt. * @param error error message of the task. * @deprecated Use * {@link #logKilled(TaskAttemptID, long, String, String, String)} */ @Deprecated public static void logKilled(TaskAttemptID taskAttemptId, long timestamp, String hostName, String error) { logKilled(taskAttemptId, timestamp, hostName, error, Values.REDUCE.name()); }
/** * Log failed reduce task attempt. * @param taskAttemptId task attempt id * @param timestamp time stamp when task failed * @param hostName host name of the task attempt. * @param error error message of the task. * @deprecated Use * {@link #logFailed(TaskAttemptID, long, String, String, String)} */ @Deprecated public static void logFailed(TaskAttemptID taskAttemptId, long timestamp, String hostName, String error){ logFailed(taskAttemptId, timestamp, hostName, error, Values.REDUCE.name()); }
private JobHistory.ReduceAttempt getReduceAttempt( String jobid, String jobTrackerId, String taskId, String taskAttemptId) { JobHistory.Task task = getTask(taskId); JobHistory.ReduceAttempt reduceAttempt = (JobHistory.ReduceAttempt) task.getTaskAttempts().get(taskAttemptId); if (null == reduceAttempt) { reduceAttempt = new JobHistory.ReduceAttempt(); reduceAttempt.set(Keys.TASK_ATTEMPT_ID, taskAttemptId); task.getTaskAttempts().put(taskAttemptId, reduceAttempt); } return reduceAttempt; }