Example usage for org.apache.hadoop.mapreduce TaskID isMap

List of usage examples for org.apache.hadoop.mapreduce TaskID isMap

Introduction

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

Prototype

@Deprecated
public boolean isMap() 

Source Link

Document

Returns whether this TaskID is a map ID.

Usage

From source file:edu.arizona.cs.hadoop.fs.irods.output.HirodsFileOutputFormat.java

License:Apache License

/**
 * Generate a unique filename, based on the task id, name, and extension
 *
 * @param context the task that is calling this
 * @param name the base filename/*from   w  ww .  j a  v  a  2 s .c  om*/
 * @param extension the filename extension
 * @return a string like $name-[mr]-$id$extension
 */
public synchronized static String getUniqueFile(TaskAttemptContext context, String name, String extension) {
    TaskID taskId = context.getTaskAttemptID().getTaskID();
    int partition = taskId.getId();
    StringBuilder result = new StringBuilder();
    result.append(name);
    result.append('-');
    result.append(taskId.isMap() ? 'm' : 'r');
    result.append('-');
    result.append(NUMBER_FORMAT.format(partition));
    result.append(extension);
    return result.toString();
}