Package org.apache.tajo.master.querymaster

Examples of org.apache.tajo.master.querymaster.QueryInProgress$QueryInProgressEventHandler


      }
    }
  }

  private void startQueryMaster(QueryId queryId, WorkerResource workResource) {
    QueryInProgress queryInProgress = masterContext.getQueryJobManager().getQueryInProgress(queryId);
    if(queryInProgress == null) {
      LOG.warn("No QueryInProgress while starting  QueryMaster:" + queryId);
      return;
    }
    queryInProgress.getQueryInfo().setQueryMasterResource(workResource);

    //fire QueryJobStart event
    queryInProgress.getEventHandler().handle(
        new QueryJobEvent(QueryJobEvent.Type.QUERY_JOB_START, queryInProgress.getQueryInfo()));
  }
View Full Code Here


        throws ServiceException {
      QueryId queryId = new QueryId(request.getQueryId());
      if (queryId.equals(QueryIdFactory.NULL_QUERY_ID)) {

      }
      QueryInProgress queryInProgress = context.getQueryJobManager().getQueryInProgress(queryId);
      QueryInfo queryInfo = queryInProgress.getQueryInfo();
      GetQueryResultResponse.Builder builder
          = GetQueryResultResponse.newBuilder();
      switch (queryInfo.getQueryState()) {
        case QUERY_SUCCEEDED:
          // TODO check this logic needed
View Full Code Here

      if (queryId.equals(QueryIdFactory.NULL_QUERY_ID)) {
        builder.setResultCode(ResultCode.OK);
        builder.setState(TajoProtos.QueryState.QUERY_SUCCEEDED);
      } else {
        QueryInProgress queryInProgress = context.getQueryJobManager().getQueryInProgress(queryId);
        if (queryInProgress != null) {
          QueryInfo queryInfo = queryInProgress.getQueryInfo();
          builder.setResultCode(ResultCode.OK);
          builder.setState(queryInfo.getQueryState());
          builder.setProgress(queryInfo.getProgress());
          builder.setSubmitTime(queryInfo.getStartTime());
          if(queryInfo.getQueryMasterHost() != null) {
View Full Code Here

  @Override
  public void stopQueryMaster(QueryId queryId) {
    try {
      FinalApplicationStatus appStatus = FinalApplicationStatus.UNDEFINED;
      QueryInProgress queryInProgress = masterContext.getQueryJobManager().getQueryInProgress(queryId);
      if(queryInProgress != null) {
        return;
      }
      TajoProtos.QueryState state = queryInProgress.getQueryInfo().getQueryState();
      if (state == TajoProtos.QueryState.QUERY_SUCCEEDED) {
        appStatus = FinalApplicationStatus.SUCCEEDED;
      } else if (state == TajoProtos.QueryState.QUERY_FAILED || state == TajoProtos.QueryState.QUERY_ERROR) {
        appStatus = FinalApplicationStatus.FAILED;
      } else if (state == TajoProtos.QueryState.QUERY_ERROR) {
View Full Code Here

      }
    }
  }

  private void startQueryMaster(QueryId queryId, AllocatedWorkerResource workResource) {
    QueryInProgress queryInProgress = masterContext.getQueryJobManager().getQueryInProgress(queryId);
    if(queryInProgress == null) {
      LOG.warn("No QueryInProgress while starting  QueryMaster:" + queryId);
      return;
    }
    queryInProgress.getQueryInfo().setQueryMasterResource(workResource.workerResource);

    //fire QueryJobStart event
    queryInProgress.getEventHandler().handle(
        new QueryJobEvent(QueryJobEvent.Type.QUERY_JOB_START, queryInProgress.getQueryInfo()));
  }
View Full Code Here

  @Override
  public void stopQueryMaster(QueryId queryId) {
    try {
      FinalApplicationStatus appStatus = FinalApplicationStatus.UNDEFINED;
      QueryInProgress queryInProgress = masterContext.getQueryJobManager().getQueryInProgress(queryId);
      if(queryInProgress == null) {
        return;
      }
      TajoProtos.QueryState state = queryInProgress.getQueryInfo().getQueryState();
      if (state == TajoProtos.QueryState.QUERY_SUCCEEDED) {
        appStatus = FinalApplicationStatus.SUCCEEDED;
      } else if (state == TajoProtos.QueryState.QUERY_FAILED || state == TajoProtos.QueryState.QUERY_ERROR) {
        appStatus = FinalApplicationStatus.FAILED;
      } else if (state == TajoProtos.QueryState.QUERY_ERROR) {
View Full Code Here

    public GetQueryResultResponse getQueryResult(RpcController controller,
                                                 GetQueryResultRequest request) throws ServiceException {
      try {
        context.getSessionManager().touch(request.getSessionId().getId());
        QueryId queryId = new QueryId(request.getQueryId());
        QueryInProgress queryInProgress = context.getQueryJobManager().getQueryInProgress(queryId);

        // if we cannot get a QueryInProgress instance from QueryJobManager,
        // the instance can be in the finished query list.
        if (queryInProgress == null) {
          queryInProgress = context.getQueryJobManager().getFinishedQuery(queryId);
        }

        GetQueryResultResponse.Builder builder = GetQueryResultResponse.newBuilder();

        // If we cannot the QueryInProgress instance from the finished list,
        // the query result was expired due to timeout.
        // In this case, we will result in error.
        if (queryInProgress == null) {
          builder.setErrorMessage("No such query: " + queryId.toString());
          return builder.build();
        }

        QueryInfo queryInfo = queryInProgress.getQueryInfo();

        try {
          //TODO After implementation Tajo's user security feature, Should be modified.
          builder.setTajoUserName(UserGroupInformation.getCurrentUser().getUserName());
        } catch (IOException e) {
View Full Code Here

        if (queryId.equals(QueryIdFactory.NULL_QUERY_ID)) {
          builder.setResultCode(ResultCode.OK);
          builder.setState(TajoProtos.QueryState.QUERY_SUCCEEDED);
        } else {
          QueryInProgress queryInProgress = context.getQueryJobManager().getQueryInProgress(queryId);

          // It will try to find a query status from a finished query list.
          if (queryInProgress == null) {
            queryInProgress = context.getQueryJobManager().getFinishedQuery(queryId);
          }
          if (queryInProgress != null) {
            QueryInfo queryInfo = queryInProgress.getQueryInfo();
            builder.setResultCode(ResultCode.OK);
            builder.setState(queryInfo.getQueryState());
            builder.setProgress(queryInfo.getProgress());
            builder.setSubmitTime(queryInfo.getStartTime());
            if(queryInfo.getQueryMasterHost() != null) {
View Full Code Here

TOP

Related Classes of org.apache.tajo.master.querymaster.QueryInProgress$QueryInProgressEventHandler

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.