Exemplo n.º 1
1
    @Override
    public Response run(JerseyResourceDelegateContext context) {
      JerseyResourceDelegateContextKey<String> queryIdKey =
          JerseyResourceDelegateContextKey.valueOf(queryIdKeyName, String.class);
      String queryId = context.get(queryIdKey);
      JerseyResourceDelegateContextKey<String> printTypeKey =
          JerseyResourceDelegateContextKey.valueOf(printTypeKeyName, String.class);
      String printType = context.get(printTypeKey);
      JerseyResourceDelegateContextKey<MasterContext> masterContextKey =
          JerseyResourceDelegateContextKey.valueOf(
              JerseyResourceDelegateUtil.MasterContextKey, MasterContext.class);
      MasterContext masterContext = context.get(masterContextKey);

      QueryId queryIdObj = TajoIdUtils.parseQueryId(queryId);

      QueryManager queryManager = masterContext.getQueryJobManager();
      QueryInProgress queryInProgress = queryManager.getQueryInProgress(queryIdObj);

      QueryInfo queryInfo = null;
      if (queryInProgress == null) {
        queryInfo = queryManager.getFinishedQuery(queryIdObj);
      } else {
        queryInfo = queryInProgress.getQueryInfo();
      }

      if (queryInfo != null) {
        if (briefPrint.equalsIgnoreCase(printType)) {
          queryInfo = getBriefQueryInfo(queryInfo);
        }
        return Response.ok(queryInfo).build();
      } else {
        return Response.status(Status.NOT_FOUND).build();
      }
    }
 @Override
 public void initApp(String user, ApplicationId appId, ByteBuffer secret) {
   // TODO these bytes should be versioned
   // TODO: Once SHuffle is out of NM, this can use MR APIs
   this.appId = appId;
   this.queryId = TajoIdUtils.parseQueryId(appId.toString());
   this.userName = user;
   userRsrc.put(appId.toString(), user);
 }
Exemplo n.º 3
0
    @Override
    public Response run(JerseyResourceDelegateContext context) {
      JerseyResourceDelegateContextKey<String> queryIdKey =
          JerseyResourceDelegateContextKey.valueOf(queryIdKeyName, String.class);
      String queryId = context.get(queryIdKey);
      JerseyResourceDelegateContextKey<MasterContext> masterContextKey =
          JerseyResourceDelegateContextKey.valueOf(
              JerseyResourceDelegateUtil.MasterContextKey, MasterContext.class);
      MasterContext masterContext = context.get(masterContextKey);

      QueryId queryIdObj = TajoIdUtils.parseQueryId(queryId);

      QueryManager queryManager = masterContext.getQueryJobManager();
      queryManager
          .getEventHandler()
          .handle(new QueryJobEvent(QueryJobEvent.Type.QUERY_JOB_KILL, new QueryInfo(queryIdObj)));
      return Response.ok().build();
    }