Package org.apache.tajo

Examples of org.apache.tajo.QueryId


  }

  @Override
  public void cleanup(RpcController controller, TajoIdProtos.QueryIdProto request,
                      RpcCallback<PrimitiveProtos.BoolProto> done) {
    workerContext.cleanup(new QueryId(request).toString());
    done.run(TajoWorker.TRUE_PROTO);
  }
View Full Code Here


      TajoMasterProtocol.WorkerResourceAllocationRequest request,
      RpcCallback<TajoMasterProtocol.WorkerResourceAllocationResponse> callBack) {
    try {
      //TODO checking queue size
      requestQueue.put(new WorkerResourceRequest(
          new QueryId(request.getExecutionBlockId().getQueryId()), false, request, callBack));
    } catch (InterruptedException e) {
      LOG.error(e.getMessage(), e);
    }
  }
View Full Code Here

    public void run() {
      startTime = System.currentTimeMillis();
      try {
        queryRespons = tajoClient.executeQuery(query);
        if (queryRespons.getResultCode() == ClientProtos.ResultCode.OK) {
          QueryId queryId = null;
          try {
            queryId = new QueryId(queryRespons.getQueryId());
            getQueryResult(queryId);
          } finally {
            if (queryId != null) {
              tajoClient.closeQuery(queryId);
            }
View Full Code Here

    this.yarnClient.init(conf);
    this.yarnClient.start();
  }

  private ApplicationAttemptId allocateAndLaunchQueryMaster(QueryInProgress queryInProgress) throws IOException, YarnException {
    QueryId queryId = queryInProgress.getQueryId();
    ApplicationId appId = ApplicationIdUtils.queryIdToAppId(queryId);

    LOG.info("Allocate and launch ApplicationMaster for QueryMaster: queryId=" +
        queryId + ", appId=" + appId);

    ApplicationSubmissionContext appContext = Records.newRecord(ApplicationSubmissionContext.class);

    // set the application id
    appContext.setApplicationId(appId);
    // set the application name
    appContext.setApplicationName("Tajo");

    Priority pri = Records.newRecord(Priority.class);
    pri.setPriority(5);
    appContext.setPriority(pri);

    // Set the queue to which this application is to be submitted in the RM
    appContext.setQueue("default");

    ContainerLaunchContext commonContainerLaunchContext =
        YarnContainerProxy.createCommonContainerLaunchContext(masterContext.getConf(), queryId.toString(), true);

    // Setup environment by cloning from common env.
    Map<String, String> env = commonContainerLaunchContext.getEnvironment();
    Map<String, String> myEnv = new HashMap<String, String>(env.size());
    myEnv.putAll(env);

    ////////////////////////////////////////////////////////////////////////////
    // Set the local resources
    ////////////////////////////////////////////////////////////////////////////
    // Set the necessary command to execute the application master
    Vector<CharSequence> vargs = new Vector<CharSequence>(30);

    // Set java executable command
    //LOG.info("Setting up app master command");
    vargs.add("${JAVA_HOME}" + "/bin/java");
    // Set Xmx based on am memory size
    String jvmOptions = masterContext.getConf().get("tajo.rm.yarn.querymaster.jvm.option", "-Xmx2000m");

    for(String eachToken: jvmOptions.split((" "))) {
      vargs.add(eachToken);
    }
    // Set Remote Debugging
    //if (!context.getQuery().getSubQuery(event.getExecutionBlockId()).isLeafQuery()) {
    //vargs.add("-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005");
    //}
    // Set class name
    vargs.add(TajoWorker.class.getCanonicalName());
    vargs.add("qm");
    vargs.add(queryId.toString()); // queryId
    vargs.add(masterContext.getTajoMasterService().getBindAddress().getHostName() + ":" +
        masterContext.getTajoMasterService().getBindAddress().getPort());

    vargs.add("1>" + ApplicationConstants.LOG_DIR_EXPANSION_VAR + "/stdout");
    vargs.add("2>" + ApplicationConstants.LOG_DIR_EXPANSION_VAR + "/stderr");
View Full Code Here

            request.getTajoQueryMasterPort() + ":" + request.getPeerRpcPort());
      }

      TajoMasterProtocol.TajoHeartbeatResponse.ResponseCommand command = null;
      if(request.hasQueryId()) {
        QueryId queryId = new QueryId(request.getQueryId());

        //heartbeat from querymaster
        //LOG.info("Received QueryHeartbeat:" + queryId + "," + request);
        QueryJobManager queryJobManager = context.getQueryJobManager();
        command = queryJobManager.queryHeartbeat(request);
View Full Code Here

    }

    @Override
    public void stopQueryMaster(RpcController controller, TajoIdProtos.QueryIdProto request,
                                RpcCallback<BoolProto> done) {
      context.getQueryJobManager().stopQuery(new QueryId(request));
      done.run(BOOL_TRUE);
    }
View Full Code Here

    final TajoConf conf = new TajoConf();
    conf.addResource(new Path(TajoConstants.SYSTEM_CONF_FILENAME));

    UserGroupInformation.setConfiguration(conf);

    final QueryId queryId = TajoIdUtils.parseQueryId(args[0]);
    final String queryMasterManagerAddr = args[1];

    LOG.info("Received QueryId:" + queryId);

    QueryMasterRunner queryMasterRunner = new QueryMasterRunner(queryId, queryMasterManagerAddr);
    queryMasterRunner.init(conf);
    queryMasterRunner.start();

    synchronized(queryId) {
      queryId.wait();
    }

    System.exit(0);
  }
View Full Code Here

    return Collections.unmodifiableCollection(finishedQueries.values());
  }

  public QueryInfo createNewQueryJob(Session session, QueryContext queryContext, String sql, LogicalRootNode plan)
      throws Exception {
    QueryId queryId = QueryIdFactory.newQueryId(masterContext.getResourceManager().getSeedQueryId());
    QueryInProgress queryInProgress = new QueryInProgress(masterContext, session, queryContext, queryId, sql, plan);

    synchronized(runningQueries) {
      runningQueries.put(queryId, queryInProgress);
    }
View Full Code Here

    queryInProgress.catchException(e);
  }

  public synchronized TajoMasterProtocol.TajoHeartbeatResponse.ResponseCommand queryHeartbeat(
      TajoMasterProtocol.TajoHeartbeat queryHeartbeat) {
    QueryInProgress queryInProgress = getQueryInProgress(new QueryId(queryHeartbeat.getQueryId()));
    if(queryInProgress == null) {
      return null;
    }

    QueryInfo queryInfo = makeQueryInfoFromHeartbeat(queryHeartbeat);
View Full Code Here

    return null;
  }

  private QueryInfo makeQueryInfoFromHeartbeat(TajoMasterProtocol.TajoHeartbeat queryHeartbeat) {
    QueryInfo queryInfo = new QueryInfo(new QueryId(queryHeartbeat.getQueryId()));
    if (queryHeartbeat.getTajoWorkerHost() != null) {
      WorkerResource queryMasterResource = new WorkerResource();
      queryMasterResource.setAllocatedHost(queryHeartbeat.getTajoWorkerHost());
      queryMasterResource.setPeerRpcPort(queryHeartbeat.getPeerRpcPort());
      queryMasterResource.setQueryMasterPort(queryHeartbeat.getTajoQueryMasterPort());
View Full Code Here

TOP

Related Classes of org.apache.tajo.QueryId

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.