List of usage examples for org.apache.hadoop.mapreduce TaskID getTaskType
public static TaskType getTaskType(char c)
From source file:org.apache.giraph.yarn.GiraphYarnTask.java
License:Apache License
/** * Utility to create a TaskAttemptId we can feed to our fake Mapper#Context. * * NOTE: ContainerId will serve as MR TaskID for Giraph tasks. * YARN container 1 is always AppMaster, so the least container id we will * ever get from YARN for a Giraph task is container id 2. Giraph on MapReduce * tasks must start at index 0. So we SUBTRACT TWO from each container id. * * @param args the command line args, fed to us by GiraphApplicationMaster. * @return the TaskAttemptId object, populated with YARN job data. *//*from w w w .j av a2s . c o m*/ private static TaskAttemptID getTaskAttemptID(String[] args) { return new TaskAttemptID(args[0], // YARN ApplicationId Cluster Timestamp Integer.parseInt(args[1]), // YARN ApplicationId # TaskID.getTaskType('m'), // Make Giraph think this is a Mapper task. Integer.parseInt(args[2]) - 2, // YARN ContainerId MINUS TWO (see above) Integer.parseInt(args[3])); // YARN AppAttemptId # }