Package org.apache.drill.exec.proto.UserBitShared

Examples of org.apache.drill.exec.proto.UserBitShared.QueryProfile


    List<ProfileInfo> runningQueries = Lists.newArrayList();
    List<ProfileInfo> finishedQueries = Lists.newArrayList();

    for(Map.Entry<String, QueryProfile> entry : store){
      QueryProfile profile = entry.getValue();
      if (profile.getState() == QueryState.RUNNING || profile.getState() == QueryState.PENDING) {
        runningQueries.add(new ProfileInfo(entry.getKey(), profile.getStart()));
      } else {
        finishedQueries.add(new ProfileInfo(entry.getKey(), profile.getStart()));
      }
    }

    Collections.sort(runningQueries, Collections.reverseOrder());
    Collections.sort(finishedQueries, Collections.reverseOrder());
View Full Code Here


      store = work.getContext().getPersistentStoreProvider().getPStore(QueryStatus.QUERY_PROFILE);
    } catch (IOException e) {
      logger.debug("Failed to get profile for: " + queryId);
      return QueryProfile.getDefaultInstance();
    }
    QueryProfile profile = store.get(queryId);
    return profile == null ?  QueryProfile.getDefaultInstance() : profile;
  }
View Full Code Here

  @GET
  @Path("/profiles/cancel/{queryid}")
  @Produces(MediaType.TEXT_PLAIN)
  public String cancelQuery(@PathParam("queryid") String queryId) throws IOException {
    PStore<QueryProfile> profiles = work.getContext().getPersistentStoreProvider().getPStore(QueryStatus.QUERY_PROFILE);
    QueryProfile profile = profiles.get(queryId);
    if (profile != null && (profile.getState() == QueryState.RUNNING || profile.getState() == QueryState.PENDING)) {
      work.getUserWorker().cancelQuery(QueryIdHelper.getQueryIdFromString(queryId));
      return "Cancelled query " + queryId;
    }
    if (profile == null) {
      return "No such query: " + queryId;
View Full Code Here

      }

    case RpcType.REQ_QUERY_STATUS_VALUE:
      QueryId queryId = get(pBody, QueryId.PARSER);
      Foreman foreman = bee.getForemanForQueryId(queryId);
      QueryProfile profile;
      if (foreman == null) {
        try {
          profile = bee.getContext().getPersistentStoreProvider().getPStore(QueryStatus.QUERY_PROFILE).get(QueryIdHelper.getQueryId(queryId));
        } catch (IOException e) {
          throw new RpcException("Failed to get persistent store", e);
View Full Code Here

      return DataRpcConfig.OK;

    case RpcType.REQ_QUERY_STATUS_VALUE:
      QueryId queryId = get(pBody, QueryId.PARSER);
      Foreman foreman = bee.getForemanForQueryId(queryId);
      QueryProfile profile;
      if (foreman == null) {
        try {
          profile = bee.getContext().getPersistentStoreProvider().getEStore(QueryStatus.RUNNING_QUERY_PROFILE).get(QueryIdHelper.getQueryId(queryId));
        } catch (IOException e) {
          throw new RpcException("Failed to get persistent store", e);
View Full Code Here

    List<ProfileInfo> runningQueries = Lists.newArrayList();
    List<ProfileInfo> finishedQueries = Lists.newArrayList();

    for (Map.Entry<String, QueryProfile> entry : eStore) {
      QueryProfile profile = entry.getValue();
      if (profile.getState() == QueryState.RUNNING || profile.getState() == QueryState.PENDING) {
        runningQueries.add(new ProfileInfo(entry.getKey(), profile.getStart(), profile.getForeman().getAddress()));
      }
    }

    for (Map.Entry<String, QueryProfile> entry : pStore) {
      QueryProfile profile = entry.getValue();
      if (profile.getState() == QueryState.COMPLETED || profile.getState() == QueryState.FAILED || profile.getState() == QueryState.CANCELED) {
        finishedQueries.add(new ProfileInfo(entry.getKey(), profile.getStart(), profile.getForeman().getAddress()));
      }
    }

    Collections.sort(runningQueries, Collections.reverseOrder());
    Collections.sort(finishedQueries, Collections.reverseOrder());
View Full Code Here

    } catch (IOException e) {
      logger.debug("Failed to get profile for: " + queryId);
      return QueryProfile.getDefaultInstance();
    }

    QueryProfile profile = null;

    //TODO: we should handle the error case better. In stead of just returning a default profile instance, we should let user know of the error happened.
    try {
      // the complete profile is now stored as blob in the PStore
      profile = pStore.getBlob(queryId);
View Full Code Here

    } catch (IOException e) {
      logger.debug("Failed to get profile for: " + queryId);
      return QueryProfile.getDefaultInstance();
    }

    QueryProfile profile = eStore.get(queryId);

    if (profile != null) {
      if (work.getBee().getForemanForQueryId(profile.getId()) != null) {
        profile = work.getBee().getForemanForQueryId(profile.getId()).getQueryStatus().getAsProfile(true);
        return profile;
      }
    } else {
        logger.debug("profile from non-foreman");
    }
View Full Code Here

  @GET
  @Path("/profiles/cancel/{queryid}")
  @Produces(MediaType.TEXT_PLAIN)
  public String cancelQuery(@PathParam("queryid") String queryId) throws IOException {
    EStore<QueryProfile> profiles = work.getContext().getPersistentStoreProvider().getEStore(QueryStatus.RUNNING_QUERY_PROFILE);
    QueryProfile profile = profiles.get(queryId);
    if (profile != null && (profile.getState() == QueryState.RUNNING || profile.getState() == QueryState.PENDING)) {
      work.getUserWorker().cancelQuery(QueryIdHelper.getQueryIdFromString(queryId));
      return "Cancelled query " + queryId;
    }
    if (profile == null) {
      return "No such query: " + queryId;
View Full Code Here

TOP

Related Classes of org.apache.drill.exec.proto.UserBitShared.QueryProfile

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.