List of usage examples for org.apache.hadoop.mapreduce TaskAttemptID getTaskID
public TaskID getTaskID()
From source file:com.nearinfinity.blur.mapreduce.BlurTask.java
License:Apache License
public String getShardName(TaskAttemptContext context) { TaskAttemptID taskAttemptID = context.getTaskAttemptID(); int id = taskAttemptID.getTaskID().getId(); return BlurUtil.getShardName(BlurConstants.SHARD_PREFIX, id); }
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 ww . j ava 2 s . c o m } } return outPath; }
From source file:cz.seznam.euphoria.hadoop.output.TestDataSinkOutputFormat.java
License:Apache License
private TaskAttemptContext mockContext(Configuration conf, int taskId) { TaskAttemptContext ret = mock(TaskAttemptContext.class); TaskAttemptID mockAttemptId = mock(TaskAttemptID.class); TaskID mockTaskId = mock(TaskID.class); when(ret.getConfiguration()).thenReturn(conf); when(ret.getTaskAttemptID()).thenReturn(mockAttemptId); when(mockAttemptId.getTaskID()).thenReturn(mockTaskId); when(mockTaskId.getId()).thenReturn(taskId); return ret;/*from w w w. j a v a2s .c o m*/ }
From source file:org.apache.giraph.yarn.GiraphYarnTask.java
License:Apache License
/** * Constructor. Build our DUMMY MRv1 data structures to pass to our * GiraphTaskManager. This allows us to continue to look the other way * while Giraph relies on MRv1 under the hood. * @param taskAttemptId the MRv1 TaskAttemptID we constructed from CLI args * supplied by GiraphApplicationMaster. *///from www. ja v a 2s .c om public GiraphYarnTask(final TaskAttemptID taskAttemptId) { conf = new ImmutableClassesGiraphConfiguration<I, V, E>(new GiraphConfiguration()); bspTaskId = taskAttemptId.getTaskID().getId(); conf.setInt("mapred.task.partition", bspTaskId); proxy = buildProxyMapperContext(taskAttemptId); graphTaskManager = new GraphTaskManager<I, V, E>(proxy); }