if(container == null) {
continue;
}
String host = container.getTaskHostName();
QueryUnitAttemptId attemptId = null;
LinkedList<QueryUnitAttemptId> list = null;
// local disk allocation
if(!leafTaskHostMapping.containsKey(host)){
host = NetUtils.normalizeHost(host);
}
TaskBlockLocation taskBlockLocation = leafTaskHostMapping.get(host);
if (taskBlockLocation != null) {
list = taskBlockLocation.getQueryUnitAttemptIdList(taskRequest.getContainerId());
}
while (list != null && list.size() > 0) {
QueryUnitAttemptId tId = list.removeFirst();
if (leafTasks.contains(tId)) {
leafTasks.remove(tId);
attemptId = tId;
//LOG.info(attemptId + " Assigned based on host match " + hostName);
hostLocalAssigned++;
break;
}
}
// rack allocation
if (attemptId == null) {
String rack = RackResolver.resolve(host).getNetworkLocation();
list = leafTasksRackMapping.get(rack);
while(list != null && list.size() > 0) {
QueryUnitAttemptId tId = list.removeFirst();
if (leafTasks.contains(tId)) {
leafTasks.remove(tId);
attemptId = tId;
//LOG.info(attemptId + "Assigned based on rack match " + rack);