Example usage for org.apache.hadoop.mapred TaskID TaskID

List of usage examples for org.apache.hadoop.mapred TaskID TaskID

Introduction

In this page you can find the example usage for org.apache.hadoop.mapred TaskID TaskID.

Prototype

public TaskID(JobID jobId, TaskType type, int id) 

Source Link

Document

Constructs a TaskID object from given JobID .

Usage

From source file:com.ibm.jaql.io.hadoop.DefaultHadoopOutputAdapter.java

License:Apache License

public void open() throws Exception {
    this.conf = new JobConf();
    this.reporter = Reporter.NULL;

    // Some OutputFormats (like FileOutputFormat) require that the job id/task id set.
    // So let's set it for all output formats, just in case they need it too.
    JobID jobid = new JobID("sequential", jobCounter.getAndIncrement());
    TaskAttemptID taskid = new TaskAttemptID(new TaskID(jobid, true, 0), 0);
    conf.set("mapred.task.id", taskid.toString());

    setSequential(conf);//w  ww.  j av  a 2s .  c om

    // Create a task so we can use committers.
    sequentialJob = new ExposeJobContext(conf, jobid);
    sequentialTask = new ExposeTaskAttemptContext(conf, taskid);

    // Give the commiter a chance initialize.
    OutputCommitter committer = conf.getOutputCommitter();
    // FIXME: We skip job setup for now because  
    committer.setupJob(sequentialJob);
    committer.setupTask(sequentialTask);

    if (oFormat instanceof JobConfigurable)
        ((JobConfigurable) oFormat).configure(conf);
}

From source file:org.apache.falcon.logging.v2.TaskLogRetrieverYarnTest.java

License:Apache License

private TaskCompletionEvent[] getTaskCompletionEvents(int numEvents, JobID jobID) {
    TaskCompletionEvent[] taskCompletionEvents = new TaskCompletionEvent[numEvents];
    for (int i = 0; i < numEvents; i++) {
        TaskAttemptID taskAttemptID = new TaskAttemptID(new TaskID(jobID, true, 0), i);
        TaskCompletionEvent taskCompletionEvent = new TaskCompletionEvent(0, taskAttemptID, 0, true,
                TaskCompletionEvent.Status.SUCCEEDED, "tracker:0");
        taskCompletionEvents[i] = taskCompletionEvent;
    }//w w  w . j a va2  s . c  o m
    return taskCompletionEvents;
}

From source file:org.apache.ignite.internal.processors.hadoop.impl.v2.HadoopV2TaskContext.java

License:Apache License

/**
 * Creates Hadoop attempt ID.//from w  w w  .  j a  v a  2s  .co  m
 *
 * @return Attempt ID.
 */
public TaskAttemptID attemptId() {
    TaskID tid = new TaskID(jobCtx.getJobID(), taskType(taskInfo().type()), taskInfo().taskNumber());

    return new TaskAttemptID(tid, taskInfo().attempt());
}

From source file:org.apache.tez.mapreduce.hadoop.IDConverter.java

License:Apache License

public static TaskID toMRTaskId(TezTaskID taskid) {
    return new TaskID(toMRJobId(taskid.getVertexID().getDAGId()),
            taskid.getVertexID().getId() == 0 ? TaskType.MAP : TaskType.REDUCE, taskid.getId());
}