Java Code Examples for org.apache.hadoop.mapreduce.TaskAttemptID#isMap()

The following examples show how to use org.apache.hadoop.mapreduce.TaskAttemptID#isMap() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SimulatorJobInProgress.java    From RDFS with Apache License 2.0 6 votes vote down vote up
/**
 * Given the reduce taskAttemptID, returns the TaskAttemptInfo. Deconstructs
 * the reduce taskAttemptID and looks up the jobStory with the parts taskType,
 * id of task, id of task attempt.
 * 
 * @param taskTracker
 *          tasktracker
 * @param taskAttemptID
 *          task-attempt
 * @return TaskAttemptInfo for the reduce task-attempt
 */
private TaskAttemptInfo getReduceTaskAttemptInfo(TaskTracker taskTracker,
    TaskAttemptID taskAttemptID) {
  assert (!taskAttemptID.isMap());
  TaskID taskId = taskAttemptID.getTaskID();
  TaskType taskType;
  if (taskAttemptID.isMap()) {
    taskType = TaskType.MAP;
  } else {
    taskType = TaskType.REDUCE;
  }

  TaskAttemptInfo taskAttemptInfo = jobStory.getTaskAttemptInfo(taskType,
      taskId.getId(), taskAttemptID.getId());
  if (LOG.isDebugEnabled()) {
    LOG.debug("get an attempt: "
        + taskAttemptID.toString()
        + ", state="
        + taskAttemptInfo.getRunState()
        + ", runtime="
        + ((taskAttemptID.isMap()) ? taskAttemptInfo.getRuntime()
            : ((ReduceTaskAttemptInfo) taskAttemptInfo).getReduceRuntime()));
  }
  return taskAttemptInfo;
}
 
Example 2
Source File: SimulatorJobInProgress.java    From RDFS with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
public TaskAttemptInfo getTaskAttemptInfo(TaskTracker taskTracker,
    TaskAttemptID taskAttemptId) {
  JobID jobid = (JobID) taskAttemptId.getJobID();
  assert (jobid == getJobID());

  return (taskAttemptId.isMap()) ? getMapTaskAttemptInfo(
      taskTracker, taskAttemptId)
      : getReduceTaskAttemptInfo(taskTracker, taskAttemptId);
}
 
Example 3
Source File: BlurOutputCommitter.java    From incubator-retired-blur with Apache License 2.0 4 votes vote down vote up
@Override
public boolean needsTaskCommit(TaskAttemptContext context) throws IOException {
  int numReduceTasks = context.getNumReduceTasks();
  TaskAttemptID taskAttemptID = context.getTaskAttemptID();
  return taskAttemptID.isMap() && numReduceTasks != 0 ? false : true;
}
 
Example 4
Source File: HadoopShims.java    From spork with Apache License 2.0 4 votes vote down vote up
static public boolean isMap(TaskAttemptID taskAttemptID) {
    return taskAttemptID.isMap();
}
 
Example 5
Source File: ZombieJob.java    From RDFS with Apache License 2.0 3 votes vote down vote up
/**
 * Mask the job ID part in a {@link TaskAttemptID}.
 * 
 * @param attemptId
 *          raw {@link TaskAttemptID} read from trace
 * @return masked {@link TaskAttemptID} with empty {@link JobID}.
 */
private TaskAttemptID maskAttemptID(TaskAttemptID attemptId) {
  JobID jobId = new JobID();
  TaskID taskId = attemptId.getTaskID();
  return new TaskAttemptID(jobId.getJtIdentifier(), jobId.getId(),
      attemptId.isMap(), taskId.getId(), attemptId.getId());
}