Package org.apache.tajo

Examples of org.apache.tajo.ExecutionBlockId


  public TaskRunner(TaskRunnerManager taskRunnerManager, TajoConf conf, String[] args) {
    super(TaskRunner.class.getName());

    this.taskRunnerManager = taskRunnerManager;
    try {
      final ExecutionBlockId executionBlockId = TajoIdUtils.createExecutionBlockId(args[1]);

      LOG.info("Tajo Root Dir: " + conf.getVar(ConfVars.ROOT_DIR));
      LOG.info("Worker Local Dir: " + conf.getVar(ConfVars.WORKER_TEMPORAL_DIR));

      UserGroupInformation.setConfiguration(conf);

      // QueryBlockId from String
      // NodeId has a form of hostname:port.
      NodeId nodeId = ConverterUtils.toNodeId(args[2]);
      this.containerId = ConverterUtils.toContainerId(args[3]);

      // QueryMaster's address
      String host = args[4];
      int port = Integer.parseInt(args[5]);
      final InetSocketAddress masterAddr = NetUtils.createSocketAddrForHost(host, port);

      LOG.info("QueryMaster Address:" + masterAddr);
      // TODO - 'load credential' should be implemented
      // Getting taskOwner
      UserGroupInformation taskOwner = UserGroupInformation.createRemoteUser(conf.getVar(ConfVars.USERNAME));
      //taskOwner.addToken(token);

      // initialize MasterWorkerProtocol as an actual task owner.
      this.client =
          taskOwner.doAs(new PrivilegedExceptionAction<AsyncRpcClient>() {
            @Override
            public AsyncRpcClient run() throws Exception {
              return new AsyncRpcClient(TajoWorkerProtocol.class, masterAddr);
            }
          });
      this.master = client.getStub();

      this.executionBlockId = executionBlockId;
      this.queryId = executionBlockId.getQueryId();
      this.nodeId = nodeId;
      this.taskOwner = taskOwner;

      this.taskRunnerContext = new TaskRunnerContext();
    } catch (Exception e) {
View Full Code Here


      }
      int numAllocatedWorkers = 0;

      if(response != null) {
        List<TajoMasterProtocol.WorkerAllocatedResource> workerHosts = response.getWorkerAllocatedResourceList();
        ExecutionBlockId executionBlockId = event.getExecutionBlockId();

        List<Container> containers = new ArrayList<Container>();
        for(TajoMasterProtocol.WorkerAllocatedResource eachWorker: workerHosts) {
          TajoWorkerContainer container = new TajoWorkerContainer();
          NodeIdPBImpl nodeId = new NodeIdPBImpl();
          String[] tokens = eachWorker.getWorkerHostAndPort().split(":");

          nodeId.setHost(tokens[0]);
          nodeId.setPort(Integer.parseInt(tokens[1]));

          TajoWorkerContainerId containerId = new TajoWorkerContainerId();

          containerId.setApplicationAttemptId(
              ApplicationIdUtils.createApplicationAttemptId(executionBlockId.getQueryId()));
          containerId.setId(containerIdSeq.incrementAndGet());

          container.setId(containerId);
          container.setNodeId(nodeId);
View Full Code Here

  @Override
  public void getTask(RpcController controller, TajoWorkerProtocol.GetTaskRequestProto request,
                      RpcCallback<TajoWorkerProtocol.QueryUnitRequestProto> done) {
    try {
      ExecutionBlockId ebId = new ExecutionBlockId(request.getExecutionBlockId());
      QueryMasterTask queryMasterTask = workerContext.getQueryMaster().getQueryMasterTask(ebId.getQueryId());
      ContainerId cid =
          queryMasterTask.getQueryTaskContext().getResourceAllocator().makeContainerId(request.getContainerId());

      if(queryMasterTask == null || queryMasterTask.isStopped()) {
        LOG.debug("getTask:" + cid + ", ebId:" + ebId + ", but query is finished.");
View Full Code Here

    if (params.containsKey("sid")) {
      List<FileChunk> chunks = Lists.newArrayList();
      List<String> queryUnidIds = splitMaps(params.get("qid"));
      for (String eachQueryUnitId : queryUnidIds) {
        String[] queryUnitIdSeqTokens = eachQueryUnitId.split("_");
        ExecutionBlockId ebId = TajoIdUtils.createExecutionBlockId(params.get("sid").get(0));
        QueryUnitId quid = new QueryUnitId(ebId, Integer.parseInt(queryUnitIdSeqTokens[0]));

        QueryUnitAttemptId attemptId = new QueryUnitAttemptId(quid, Integer.parseInt(queryUnitIdSeqTokens[1]));

        RetrieverHandler handler = handlerMap.get(attemptId.toString());
View Full Code Here

  public static DecimalFormat MASTER_ID_FORMAT = new DecimalFormat("0000000000000");

  public static ExecutionBlockId createExecutionBlockId(String idStr) {
    String[] tokens = idStr.split("_");

    return new ExecutionBlockId(new QueryId(tokens[1], Integer.parseInt(tokens[2])), Integer.parseInt(tokens[3]));
  }
View Full Code Here

      } else if (execBlock.getScanNodes().length > 1) { // Case 2: Join
        tasks = Repartitioner.createJoinTasks(subQuery);

      } else { // Case 3: Others (Sort or Aggregation)
        int numTasks = getNonLeafTaskNum(subQuery);
        ExecutionBlockId childId = masterPlan.getChilds(subQuery.getBlock()).get(0).getId();
        SubQuery child = subQuery.context.getSubQuery(childId);
        DataChannel channel = masterPlan.getChannel(child.getId(), subQuery.getId());
        tasks = Repartitioner.createNonLeafTask(masterPlan, subQuery, child, channel, numTasks);
      }
View Full Code Here

    this(srcId, targetId, partitionType);
    this.partitionNum = partNum;
  }

  public DataChannel(DataChannelProto proto) {
    this.srcId = new ExecutionBlockId(proto.getSrcId());
    this.targetId = new ExecutionBlockId(proto.getTargetId());
    this.transmitType = proto.getTransmitType();
    this.partitionType = proto.getPartitionType();
    if (proto.hasSchema()) {
      this.setSchema(new Schema(proto.getSchema()));
    }
View Full Code Here

  private ExecutionBlock terminalBlock;
  private Map<ExecutionBlockId, ExecutionBlock> execBlockMap = new HashMap<ExecutionBlockId, ExecutionBlock>();
  private SimpleDirectedGraph<ExecutionBlockId, DataChannel> execBlockGraph = new SimpleDirectedGraph<ExecutionBlockId, DataChannel>();

  public ExecutionBlockId newExecutionBlockId() {
    return new ExecutionBlockId(queryId, nextId.incrementAndGet());
  }
View Full Code Here

      }
      LOG.info("================================================================");

      Map<ExecutionBlockId, List<Container>> allocated = new HashMap<ExecutionBlockId, List<Container>>();
      for (Container container : allocatedContainers) {
        ExecutionBlockId executionBlockId = subQueryMap.get(container.getPriority());
        SubQueryState state = context.getSubQuery(executionBlockId).getState();
        if (!(SubQuery.isRunningState(state))) {
          releaseAssignedContainer(container.getId());
        } else {
          if (allocated.containsKey(executionBlockId)) {
View Full Code Here

        try {
          WorkerResourceRequest resourceRequest = requestQueue.take();

          if (LOG.isDebugEnabled()) {
            LOG.debug("allocateWorkerResources:" +
                (new ExecutionBlockId(resourceRequest.request.getExecutionBlockId())) +
                ", required:" + resourceRequest.request.getNumWorks() +
                ", queryMasterRequest=" + resourceRequest.queryMasterRequest +
                ", liveWorkers=" + liveWorkerResources.size());
          }
View Full Code Here

TOP

Related Classes of org.apache.tajo.ExecutionBlockId

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.