本文整理汇总了Java中org.apache.hadoop.mapreduce.TaskID.getId方法的典型用法代码示例。如果您正苦于以下问题:Java TaskID.getId方法的具体用法?Java TaskID.getId怎么用?Java TaskID.getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.mapreduce.TaskID
的用法示例。
在下文中一共展示了TaskID.getId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUniqueFile
import org.apache.hadoop.mapreduce.TaskID; //导入方法依赖的package包/类
/**
* 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
* @param extension the filename extension
* @return a string like $name-[mrsct]-$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.getRepresentingCharacter(taskId.getTaskType()));
result.append('-');
result.append(NUMBER_FORMAT.format(partition));
result.append(extension);
return result.toString();
}
示例2: maskAttemptID
import org.apache.hadoop.mapreduce.TaskID; //导入方法依赖的package包/类
/**
* 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();
TaskType taskType = attemptId.getTaskType();
TaskID taskId = attemptId.getTaskID();
return new TaskAttemptID(jobId.getJtIdentifier(), jobId.getId(), taskType,
taskId.getId(), attemptId.getId());
}
示例3: tipFailed
import org.apache.hadoop.mapreduce.TaskID; //导入方法依赖的package包/类
public synchronized void tipFailed(TaskID taskId) {
if (!finishedMaps[taskId.getId()]) {
finishedMaps[taskId.getId()] = true;
if (--remainingMaps == 0) {
notifyAll();
}
updateStatus();
}
}
示例4: getUniqueName
import org.apache.hadoop.mapreduce.TaskID; //导入方法依赖的package包/类
protected String getUniqueName(String name, String extension) {
int partition;
NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMinimumIntegerDigits(5);
numberFormat.setGroupingUsed(false);
if (null != getTaskAttemptContext()) {
TaskID taskId = getTaskAttemptContext().getTaskAttemptID().getTaskID();
partition = taskId.getId();
} else {
partition = getConfiguration().getInt(JobContext.TASK_PARTITION, -1);
}
if (partition == -1) {
throw new IllegalArgumentException("This method can only be called from an application");
}
String taskType = getConfiguration().getBoolean(JobContext.TASK_ISMAP, JobContext.DEFAULT_TASK_ISMAP) ? "m" : "r";
StringBuilder result = new StringBuilder();
result.append(name);
result.append('-');
result.append(taskType);
result.append('-');
result.append(numberFormat.format(partition));
result.append(extension);
return result.toString();
}
示例5: maskTaskID
import org.apache.hadoop.mapreduce.TaskID; //导入方法依赖的package包/类
/**
* Mask the job ID part in a {@link TaskID}.
*
* @param taskId
* raw {@link TaskID} read from trace
* @return masked {@link TaskID} with empty {@link JobID}.
*/
private TaskID maskTaskID(TaskID taskId) {
JobID jobId = new JobID();
TaskType taskType = taskId.getTaskType();
return new TaskID(jobId, taskType, taskId.getId());
}