if (mapInputBytes < 0) {
LOG.warn("InputBytes for task "+mapTask.getTaskID()+" is not defined.");
mapInputBytes = 0;
}
splitsList.add(new FileSplit(emptyPath, 0, mapInputBytes, hosts));
}
// If not all map tasks are in job trace, should make up some splits
// for missing map tasks.
int totalMaps = job.getTotalMaps();
if (totalMaps < splitsList.size()) {
LOG.warn("TotalMaps for job " + job.getJobID()
+ " is less than the total number of map task descriptions ("
+ totalMaps + "<" + splitsList.size() + ").");
}
int avgHostPerSplit;
if (splitsList.size() == 0) {
avgHostPerSplit = 3;
} else {
avgHostPerSplit = totalHosts / splitsList.size();
if (avgHostPerSplit == 0) {
avgHostPerSplit = 3;
}
}
for (int i = splitsList.size(); i < totalMaps; i++) {
if (cluster == null) {
splitsList.add(new FileSplit(emptyPath, 0, 0, new String[0]));
} else {
MachineNode[] mNodes = cluster.getRandomMachines(avgHostPerSplit);
String[] hosts = new String[mNodes.length];
for (int j = 0; j < hosts.length; ++j) {
hosts[j] = mNodes[j].getName();
}
// TODO set size of a split to 0 now.
splitsList.add(new FileSplit(emptyPath, 0, 0, hosts));
}
}
splits = splitsList.toArray(new InputSplit[splitsList.size()]);
}