Esempio n. 1
0
  private Set<Integer> getWorkerIds(Collection<String> hosts) {
    Set<Integer> workerIds = Sets.newHashSet();
    if (hosts.isEmpty()) return workerIds;

    for (WorkerConnectionInfo worker : stage.getContext().getWorkerMap().values()) {
      if (hosts.contains(worker.getHost())) {
        workerIds.add(worker.getId());
      }
    }
    return workerIds;
  }
Esempio n. 2
0
  @Override
  public void start() {
    LOG.info("Start TaskScheduler");
    maximumRequestContainer =
        tajoConf.getInt(REQUEST_MAX_NUM, stage.getContext().getWorkerMap().size() * 2);

    if (isLeaf) {
      candidateWorkers.addAll(getWorkerIds(getLeafTaskHosts()));
    } else {
      // find assigned hosts for Non-Leaf locality in children executionBlock
      List<ExecutionBlock> executionBlockList = stage.getMasterPlan().getChilds(stage.getBlock());
      for (ExecutionBlock executionBlock : executionBlockList) {
        Stage childStage = stage.getContext().getStage(executionBlock.getId());
        candidateWorkers.addAll(childStage.getAssignedWorkerMap().keySet());
      }
    }

    this.schedulingThread.start();
    super.start();
  }