Program: 172956
Project: 172956
Buggy source:
/** 
 * Let assume we have 2 tasks per container and one additional for first container, which will be the destination
 * @param plan the resource plan from scheduler
 * @return task plan
 */
public static TaskPlan createWordCountPlan(Config cfg,ResourcePlan plan,int noOfTasks){
  int noOfProcs=plan.noOfContainers();
  Map<Integer,Set<Integer>> executorToGraphNodes=new HashMap<>();
  Map<Integer,Set<Integer>> groupsToExeuctors=new HashMap<>();
  int thisExecutor=plan.getThisId();
  List<ResourceContainer> containers=plan.getContainers();
  Map<String,List<ResourceContainer>> containersPerNode=new HashMap<>();
  for (  ResourceContainer c : containers) {
    String name=(String)c.getProperty(SchedulerContext.WORKER_NAME);
    List<ResourceContainer> containerList;
    if (!containersPerNode.containsKey(name)) {
      containerList=new ArrayList<>();
      containersPerNode.put(name,containerList);
    }
 else {
      containerList=containersPerNode.get(name);
    }
    containerList.add(c);
  }
  int taskPerExecutor=noOfTasks / noOfProcs;
  for (int i=0; i < noOfProcs; i++) {
    Set<Integer> nodesOfExecutor=new HashSet<>();
    for (int j=0; j < taskPerExecutor; j++) {
      nodesOfExecutor.add(i * taskPerExecutor + j);
    }
    executorToGraphNodes.put(i,nodesOfExecutor);
  }
  int i=0;
  for (  Map.Entry<String,List<ResourceContainer>> e : containersPerNode.entrySet()) {
    Set<Integer> executorsOfGroup=new HashSet<>();
    for (    ResourceContainer c : e.getValue()) {
      executorsOfGroup.add(c.getId());
    }
    groupsToExeuctors.put(i,executorsOfGroup);
    i++;
  }
  LOG.fine(String.format("String_Node_Str",plan.getThisId(),executorToGraphNodes));
  LOG.fine(String.format("String_Node_Str",plan.getThisId(),groupsToExeuctors));
  return new TaskPlan(executorToGraphNodes,groupsToExeuctors,thisExecutor);
}

Fixed version (ground truth):
/** 
 * Let assume we have 2 tasks per container and one additional for first container, which will be the destination
 * @param plan the resource plan from scheduler
 * @return task plan
 */
public static TaskPlan createWordCountPlan(Config cfg,ResourcePlan plan,int noOfTasks){
  int noOfProcs=plan.noOfContainers();
  Map<Integer,Set<Integer>> executorToGraphNodes=new HashMap<>();
  Map<Integer,Set<Integer>> groupsToExeuctors=new HashMap<>();
  int thisExecutor=plan.getThisId();
  List<ResourceContainer> containers=plan.getContainers();
  Map<String,List<ResourceContainer>> containersPerNode=new HashMap<>();
  for (  ResourceContainer c : containers) {
    String name=(String)c.getProperty(SchedulerContext.WORKER_NAME);
    List<ResourceContainer> containerList;
    if (!containersPerNode.containsKey(name)) {
      containerList=new ArrayList<>();
      containersPerNode.put(name,containerList);
    }
 else {
      containerList=containersPerNode.get(name);
    }
    containerList.add(c);
  }
  int taskPerExecutor=noOfTasks / noOfProcs;
  for (int i=0; i < noOfProcs; i++) {
    Set<Integer> nodesOfExecutor=new HashSet<>();
    for (int j=0; j < taskPerExecutor; j++) {
      nodesOfExecutor.add(i * taskPerExecutor + j);
    }
    if (i == 0) {
      nodesOfExecutor.add(noOfTasks);
    }
    executorToGraphNodes.put(i,nodesOfExecutor);
  }
  int i=0;
  for (  Map.Entry<String,List<ResourceContainer>> e : containersPerNode.entrySet()) {
    Set<Integer> executorsOfGroup=new HashSet<>();
    for (    ResourceContainer c : e.getValue()) {
      executorsOfGroup.add(c.getId());
    }
    groupsToExeuctors.put(i,executorsOfGroup);
    i++;
  }
  LOG.fine(String.format("String_Node_Str",plan.getThisId(),executorToGraphNodes));
  LOG.fine(String.format("String_Node_Str",plan.getThisId(),groupsToExeuctors));
  return new TaskPlan(executorToGraphNodes,groupsToExeuctors,thisExecutor);
}