Package org.apache.tajo.master.querymaster

Examples of org.apache.tajo.master.querymaster.QueryMasterTask


      if (queryId.equals(QueryIdFactory.NULL_QUERY_ID)) {
        builder.setResultCode(ClientProtos.ResultCode.OK);
        builder.setState(TajoProtos.QueryState.QUERY_SUCCEEDED);
      } else {
        QueryMasterTask queryMasterTask = workerContext.getQueryMaster().getQueryMasterTask(queryId);
        builder.setResultCode(ClientProtos.ResultCode.OK);
        builder.setQueryMasterHost(bindAddr.getHostName());
        builder.setQueryMasterPort(bindAddr.getPort());

        if (queryMasterTask != null) {
          queryMasterTask.touchSessionTime();
          Query query = queryMasterTask.getQuery();

          builder.setState(query.getState());
          builder.setProgress(query.getProgress());
          builder.setSubmitTime(query.getAppSubmitTime());
          builder.setInitTime(query.getInitializationTime());
          builder.setHasResult(
              !(queryMasterTask.getQueryTaskContext().getQueryContext().isCreateTable() ||
                  queryMasterTask.getQueryTaskContext().getQueryContext().isInsert())
          );
          if (query.getState() == TajoProtos.QueryState.QUERY_SUCCEEDED) {
            builder.setFinishTime(query.getFinishTime());
          } else {
            builder.setFinishTime(System.currentTimeMillis());
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.");
        done.run(TaskSchedulerImpl.stopTaskRunnerReq);
      } else {
        LOG.debug("getTask:" + cid + ", ebId:" + ebId);
        queryMasterTask.handleTaskRequestEvent(new TaskRequestEvent(cid, ebId, done));
      }
    } catch (Exception e) {
      LOG.error(e.getMessage(), e);
    }
  }
View Full Code Here

  @Override
  public void statusUpdate(RpcController controller, TajoWorkerProtocol.TaskStatusProto request,
                           RpcCallback<PrimitiveProtos.BoolProto> done) {
    try {
      QueryMasterTask queryMasterTask = queryMaster.getQueryMasterTask(
          new QueryId(request.getId().getQueryUnitId().getExecutionBlockId().getQueryId()));
      queryMasterTask.getEventHandler().handle(
          new TaskAttemptStatusUpdateEvent(new QueryUnitAttemptId(request.getId()), request));
      done.run(TajoWorker.TRUE_PROTO);
    } catch (Exception e) {
      LOG.error(e.getMessage(), e);
      done.run(TajoWorker.FALSE_PROTO);
View Full Code Here

  @Override
  public void fatalError(RpcController controller, TajoWorkerProtocol.TaskFatalErrorReport report,
                         RpcCallback<PrimitiveProtos.BoolProto> done) {
    try {
      QueryMasterTask queryMasterTask = queryMaster.getQueryMasterTask(
          new QueryId(report.getId().getQueryUnitId().getExecutionBlockId().getQueryId()));
      queryMasterTask.getEventHandler().handle(new TaskFatalErrorEvent(report));
      done.run(TajoWorker.TRUE_PROTO);
    } catch (Exception e) {
      LOG.error(e.getMessage(), e);
      done.run(TajoWorker.FALSE_PROTO);
    }
View Full Code Here

  @Override
  public void done(RpcController controller, TajoWorkerProtocol.TaskCompletionReport report,
                   RpcCallback<PrimitiveProtos.BoolProto> done) {
    try {
      QueryMasterTask queryMasterTask = queryMaster.getQueryMasterTask(
          new QueryId(report.getId().getQueryUnitId().getExecutionBlockId().getQueryId()));
      queryMasterTask.getEventHandler().handle(new TaskCompletionEvent(report));
      done.run(TajoWorker.TRUE_PROTO);
    } catch (Exception e) {
      LOG.error(e.getMessage(), e);
      done.run(TajoWorker.FALSE_PROTO);
    }
View Full Code Here

      if (queryId.equals(QueryIdFactory.NULL_QUERY_ID)) {
        builder.setResultCode(ClientProtos.ResultCode.OK);
        builder.setState(TajoProtos.QueryState.QUERY_SUCCEEDED);
      } else {
        QueryMasterTask queryMasterTask = workerContext.getQueryMaster().getQueryMasterTask(queryId);

        builder.setResultCode(ClientProtos.ResultCode.OK);
        builder.setQueryMasterHost(bindAddr.getHostName());
        builder.setQueryMasterPort(bindAddr.getPort());

        if (queryMasterTask == null) {
          queryMasterTask = workerContext.getQueryMaster().getQueryMasterTask(queryId, true);
        }
        if (queryMasterTask == null) {
          builder.setState(TajoProtos.QueryState.QUERY_NOT_ASSIGNED);
          return builder.build();
        }

        builder.setHasResult(
            !(queryMasterTask.getQueryTaskContext().getQueryContext().isCreateTable() ||
                queryMasterTask.getQueryTaskContext().getQueryContext().isInsert())
        );

        queryMasterTask.touchSessionTime();
        Query query = queryMasterTask.getQuery();

        if (query != null) {
          builder.setState(query.getState());
          builder.setProgress(query.getProgress());
          builder.setSubmitTime(query.getAppSubmitTime());
          if (query.getState() == TajoProtos.QueryState.QUERY_SUCCEEDED) {
            builder.setFinishTime(query.getFinishTime());
          } else {
            builder.setFinishTime(System.currentTimeMillis());
          }
        } else {
          builder.setState(queryMasterTask.getState());
          builder.setErrorMessage(queryMasterTask.getErrorMessage());
        }
      }
      return builder.build();
    }
View Full Code Here

    cleanupQuery(res);
  }

  private MasterPlan getQueryPlan(QueryId queryId) {
    for (TajoWorker eachWorker: testingCluster.getTajoWorkers()) {
      QueryMasterTask queryMasterTask = eachWorker.getWorkerContext().getQueryMaster().getQueryMasterTask(queryId, true);
      if (queryMasterTask != null) {
        return queryMasterTask.getQuery().getPlan();
      }
    }

    fail("Can't find query from workers" + queryId);
    return null;
View Full Code Here

TOP

Related Classes of org.apache.tajo.master.querymaster.QueryMasterTask

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.