Ejemplo n.º 1
0
 void updatePendingTasks() {
   pendingTasks.clear();
   for (int i = 0; i < context.getVertexNumTasks(context.getVertexName()); ++i) {
     pendingTasks.add(new Integer(i));
   }
   totalTasksToSchedule = pendingTasks.size();
 }
Ejemplo n.º 2
0
  @Override
  public void onVertexStarted(Map<String, List<Integer>> completions) {
    pendingTasks =
        Lists.newArrayListWithCapacity(context.getVertexNumTasks(context.getVertexName()));
    // track the tasks in this vertex
    updatePendingTasks();
    updateSourceTaskCount();

    LOG.info(
        "OnVertexStarted vertex: "
            + context.getVertexName()
            + " with "
            + numSourceTasks
            + " source tasks and "
            + totalTasksToSchedule
            + " pending tasks");

    if (completions != null) {
      for (Map.Entry<String, List<Integer>> entry : completions.entrySet()) {
        for (Integer taskId : entry.getValue()) {
          onSourceTaskCompleted(entry.getKey(), taskId);
        }
      }
    }
    // for the special case when source has 0 tasks or min fraction == 0
    schedulePendingTasks();
  }
Ejemplo n.º 3
0
 void updateSourceTaskCount() {
   // track source vertices
   int numSrcTasks = 0;
   for (String vertex : bipartiteSources.keySet()) {
     numSrcTasks += context.getVertexNumTasks(vertex);
   }
   numSourceTasks = numSrcTasks;
 }