Example usage for org.apache.hadoop.mapreduce TaskAttemptID getTaskType

List of usage examples for org.apache.hadoop.mapreduce TaskAttemptID getTaskType

Introduction

In this page you can find the example usage for org.apache.hadoop.mapreduce TaskAttemptID getTaskType.

Prototype

public TaskType getTaskType() 

Source Link

Document

Returns the TaskType of the TaskAttemptID

Usage

From source file:com.netflix.bdp.s3.TestS3MultipartOutputCommitter.java

License:Apache License

private static Path writeOutputFile(TaskAttemptID id, Path dest, String content, long copies)
        throws IOException {
    String fileName = ((id.getTaskType() == TaskType.REDUCE) ? "r_" : "m_") + id.getTaskID().getId() + "_"
            + id.getId() + "_" + UUID.randomUUID().toString();
    Path outPath = new Path(dest, fileName);
    FileSystem fs = outPath.getFileSystem(getConfiguration());

    try (OutputStream out = fs.create(outPath)) {
        byte[] bytes = content.getBytes(StandardCharsets.UTF_8);
        for (int i = 0; i < copies; i += 1) {
            out.write(bytes);/* w  w  w .  j  av  a  2  s  . c o  m*/
        }
    }

    return outPath;
}

From source file:org.apache.pig.backend.hadoop.executionengine.shims.HadoopShims.java

License:Apache License

static public boolean isMap(TaskAttemptID taskAttemptID) {
    TaskType type = taskAttemptID.getTaskType();
    if (type == TaskType.MAP)
        return true;

    return false;
}