Ejemplo n.º 1
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();
  }
Ejemplo n.º 2
0
  @Override
  public void init(Configuration conf) {
    tajoConf = TUtil.checkTypeAndGet(conf, TajoConf.class);
    rpcParams = RpcParameterFactory.get(new TajoConf());

    scheduledRequests = new ScheduledRequests();
    minTaskMemory = tajoConf.getIntVar(TajoConf.ConfVars.TASK_RESOURCE_MINIMUM_MEMORY);
    schedulerDelay = tajoConf.getIntVar(TajoConf.ConfVars.QUERYMASTER_TASK_SCHEDULER_DELAY);
    isLeaf = stage.getMasterPlan().isLeaf(stage.getBlock());

    this.schedulingThread =
        new Thread() {
          public void run() {

            while (!isStopped && !Thread.currentThread().isInterrupted()) {

              try {
                schedule();
              } catch (InterruptedException e) {
                if (isStopped) {
                  break;
                } else {
                  LOG.fatal(e.getMessage(), e);
                  stage.abort(StageState.ERROR);
                }
              } catch (Throwable e) {
                LOG.fatal(e.getMessage(), e);
                stage.abort(StageState.ERROR);
                break;
              }
            }
            LOG.info("TaskScheduler schedulingThread stopped");
          }
        };
    super.init(conf);
  }