Program: 172965
Project: 172965
Buggy source:
@Override public ExecutionPlan schedule(Config cfg,DataFlowTaskGraph taskGraph,TaskSchedulePlan taskSchedule){
  noOfThreads=ExecutorContext.threadsPerContainer(cfg);
  TaskPlan taskPlan=TaskPlanBuilder.build(resourcePlan,taskSchedule,taskIdGenerator);
  ParallelOperationFactory opFactory=new ParallelOperationFactory(cfg,network.getChannel(),taskPlan,edgeGenerator);
  Map<Integer,TaskSchedulePlan.ContainerPlan> containersMap=taskSchedule.getContainersMap();
  TaskSchedulePlan.ContainerPlan conPlan=containersMap.get(workerId);
  if (conPlan == null) {
    LOG.log(Level.INFO,"String_Node_Str" + workerId);
    return null;
  }
  ExecutionPlan execution=new ExecutionPlan();
  execution.setNumThreads(noOfThreads);
  Set<TaskSchedulePlan.TaskInstancePlan> instancePlan=conPlan.getTaskInstances();
  for (  TaskSchedulePlan.TaskInstancePlan ip : instancePlan) {
    Vertex v=taskGraph.vertex(ip.getTaskName());
    if (v == null) {
      throw new RuntimeException("String_Node_Str" + ip.getTaskName());
    }
    INode node=v.getTask();
    if (node instanceof ITask || node instanceof ISource) {
      Set<Edge> edges=taskGraph.outEdges(v);
      for (      Edge e : edges) {
        Vertex child=taskGraph.childOfTask(v,e.getName());
        Set<Integer> srcTasks=taskIdGenerator.getTaskIds(v.getName(),ip.getTaskId(),taskGraph);
        Set<Integer> tarTasks=taskIdGenerator.getTaskIds(child.getName(),getTaskIdOfTask(child.getName(),taskSchedule),taskGraph);
        if (!parOpTable.contains(v.getName(),e.getName())) {
          parOpTable.put(v.getName(),e.getName(),new Communication(e,v.getName(),child.getName(),srcTasks,tarTasks));
          sendTable.put(v.getName(),e.getName(),new Communication(e,v.getName(),child.getName(),srcTasks,tarTasks));
        }
      }
    }
    if (node instanceof ITask || node instanceof ISink) {
      Set<Edge> parentEdges=taskGraph.inEdges(v);
      for (      Edge e : parentEdges) {
        Vertex parent=taskGraph.getParentOfTask(v,e.getName());
        Set<Integer> srcTasks=taskIdGenerator.getTaskIds(parent.getName(),getTaskIdOfTask(parent.getName(),taskSchedule),taskGraph);
        Set<Integer> tarTasks=taskIdGenerator.getTaskIds(v.getName(),ip.getTaskId(),taskGraph);
        if (!parOpTable.contains(parent.getName(),e.getName())) {
          parOpTable.put(parent.getName(),e.getName(),new Communication(e,parent.getName(),v.getName(),srcTasks,tarTasks));
          recvTable.put(parent.getName(),e.getName(),new Communication(e,parent.getName(),v.getName(),srcTasks,tarTasks));
        }
      }
    }
    INodeInstance iNodeInstance=createInstances(cfg,ip,v);
    execution.addNodes(taskIdGenerator.generateGlobalTaskId(v.getName(),ip.getTaskId(),ip.getTaskIndex()),iNodeInstance);
  }
  for (  Table.Cell<String,String,Communication> cell : parOpTable.cellSet()) {
    Communication c=cell.getValue();
    IParallelOperation op=opFactory.build(c.getEdge(),c.getSourceTasks(),c.getTargetTasks());
    Set<Integer> sourcesOfThisWorker=intersectionOfTasks(conPlan,c.getSourceTasks());
    Set<Integer> targetsOfThisWorker=intersectionOfTasks(conPlan,c.getTargetTasks());
    for (    Integer i : sourcesOfThisWorker) {
      if (taskInstances.contains(c.getSourceTask(),i)) {
        TaskInstance taskInstance=taskInstances.get(c.getSourceTask(),i);
        taskInstance.registerOutParallelOperation(c.getEdge().getName(),op);
      }
 else       if (sourceInstances.contains(c.getSourceTask(),i)) {
        SourceInstance sourceInstance=sourceInstances.get(c.getSourceTask(),i);
        sourceInstance.registerOutParallelOperation(c.getEdge().getName(),op);
      }
 else {
        throw new RuntimeException("String_Node_Str" + c.getSourceTask());
      }
    }
    for (    Integer i : targetsOfThisWorker) {
      if (taskInstances.contains(c.getTargetTask(),i)) {
        TaskInstance taskInstance=taskInstances.get(c.getTargetTask(),i);
        op.register(i,taskInstance.getInQueue());
      }
 else       if (sinkInstances.contains(c.getTargetTask(),i)) {
        SinkInstance sourceInstance=sinkInstances.get(c.getTargetTask(),i);
        op.register(i,sourceInstance.getInQueue());
      }
 else {
        throw new RuntimeException("String_Node_Str" + c.getTargetTask());
      }
    }
    execution.addOps(op);
  }
  return execution;
}

Fixed version (ground truth):
@Override public ExecutionPlan schedule(Config cfg,DataFlowTaskGraph taskGraph,TaskSchedulePlan taskSchedule){
  noOfThreads=ExecutorContext.threadsPerContainer(cfg);
  TaskPlan taskPlan=TaskPlanBuilder.build(resourcePlan,taskSchedule,taskIdGenerator);
  ParallelOperationFactory opFactory=new ParallelOperationFactory(cfg,network.getChannel(),taskPlan,edgeGenerator);
  Map<Integer,TaskSchedulePlan.ContainerPlan> containersMap=taskSchedule.getContainersMap();
  TaskSchedulePlan.ContainerPlan conPlan=containersMap.get(workerId);
  if (conPlan == null) {
    LOG.log(Level.INFO,"String_Node_Str" + workerId);
    return null;
  }
  ExecutionPlan execution=new ExecutionPlan();
  execution.setNumThreads(noOfThreads);
  Set<TaskSchedulePlan.TaskInstancePlan> instancePlan=conPlan.getTaskInstances();
  for (  TaskSchedulePlan.TaskInstancePlan ip : instancePlan) {
    Vertex v=taskGraph.vertex(ip.getTaskName());
    if (v == null) {
      throw new RuntimeException("String_Node_Str" + ip.getTaskName());
    }
    INode node=v.getTask();
    if (node instanceof ITask || node instanceof ISource) {
      Set<Edge> edges=taskGraph.outEdges(v);
      for (      Edge e : edges) {
        Vertex child=taskGraph.childOfTask(v,e.getName());
        Set<Integer> srcTasks=taskIdGenerator.getTaskIds(v.getName(),ip.getTaskId(),taskGraph);
        Set<Integer> tarTasks=taskIdGenerator.getTaskIds(child.getName(),getTaskIdOfTask(child.getName(),taskSchedule),taskGraph);
        if (!parOpTable.contains(v.getName(),e.getName())) {
          parOpTable.put(v.getName(),e.getName(),new Communication(e,v.getName(),child.getName(),srcTasks,tarTasks));
        }
      }
    }
    if (node instanceof ITask || node instanceof ISink) {
      Set<Edge> parentEdges=taskGraph.inEdges(v);
      for (      Edge e : parentEdges) {
        Vertex parent=taskGraph.getParentOfTask(v,e.getName());
        Set<Integer> srcTasks=taskIdGenerator.getTaskIds(parent.getName(),getTaskIdOfTask(parent.getName(),taskSchedule),taskGraph);
        Set<Integer> tarTasks=taskIdGenerator.getTaskIds(v.getName(),ip.getTaskId(),taskGraph);
        if (!parOpTable.contains(parent.getName(),e.getName())) {
          parOpTable.put(parent.getName(),e.getName(),new Communication(e,parent.getName(),v.getName(),srcTasks,tarTasks));
        }
      }
    }
    INodeInstance iNodeInstance=createInstances(cfg,ip,v);
    execution.addNodes(taskIdGenerator.generateGlobalTaskId(v.getName(),ip.getTaskId(),ip.getTaskIndex()),iNodeInstance);
  }
  for (  Table.Cell<String,String,Communication> cell : parOpTable.cellSet()) {
    Communication c=cell.getValue();
    IParallelOperation op=opFactory.build(c.getEdge(),c.getSourceTasks(),c.getTargetTasks());
    Set<Integer> sourcesOfThisWorker=intersectionOfTasks(conPlan,c.getSourceTasks());
    Set<Integer> targetsOfThisWorker=intersectionOfTasks(conPlan,c.getTargetTasks());
    for (    Integer i : sourcesOfThisWorker) {
      if (taskInstances.contains(c.getSourceTask(),i)) {
        TaskInstance taskInstance=taskInstances.get(c.getSourceTask(),i);
        taskInstance.registerOutParallelOperation(c.getEdge().getName(),op);
      }
 else       if (sourceInstances.contains(c.getSourceTask(),i)) {
        SourceInstance sourceInstance=sourceInstances.get(c.getSourceTask(),i);
        sourceInstance.registerOutParallelOperation(c.getEdge().getName(),op);
      }
 else {
        throw new RuntimeException("String_Node_Str" + c.getSourceTask());
      }
    }
    for (    Integer i : targetsOfThisWorker) {
      if (taskInstances.contains(c.getTargetTask(),i)) {
        TaskInstance taskInstance=taskInstances.get(c.getTargetTask(),i);
        op.register(i,taskInstance.getInQueue());
        taskInstance.registerInParallelOperation(c.getEdge().getName(),op);
      }
 else       if (sinkInstances.contains(c.getTargetTask(),i)) {
        SinkInstance sourceInstance=sinkInstances.get(c.getTargetTask(),i);
        sourceInstance.registerInParallelOperation(c.getEdge().getName(),op);
        op.register(i,sourceInstance.getInQueue());
      }
 else {
        throw new RuntimeException("String_Node_Str" + c.getTargetTask());
      }
    }
    execution.addOps(op);
  }
  return execution;
}