Example #1
0
    private void finalizeQuery(Query query, QueryCompletedEvent event) {
      MasterPlan masterPlan = query.getPlan();

      ExecutionBlock terminal = query.getPlan().getTerminalBlock();
      DataChannel finalChannel =
          masterPlan.getChannel(event.getExecutionBlockId(), terminal.getId());
      Path finalOutputDir = commitOutputData(query);

      QueryHookExecutor hookExecutor = new QueryHookExecutor(query.context.getQueryMasterContext());
      try {
        hookExecutor.execute(
            query.context.getQueryContext(), query, event.getExecutionBlockId(), finalOutputDir);
      } catch (Exception e) {
        query.eventHandler.handle(
            new QueryDiagnosticsUpdateEvent(query.id, ExceptionUtils.getStackTrace(e)));
      }
    }
Example #2
0
    private void executeNextBlock(Query query) {
      ExecutionBlockCursor cursor = query.getExecutionBlockCursor();
      ExecutionBlock nextBlock = cursor.nextBlock();
      SubQuery nextSubQuery = new SubQuery(query.context, query.getPlan(), nextBlock, query.sm);
      nextSubQuery.setPriority(query.priority--);
      query.addSubQuery(nextSubQuery);
      nextSubQuery.handle(new SubQueryEvent(nextSubQuery.getId(), SubQueryEventType.SQ_INIT));

      LOG.info("Scheduling SubQuery:" + nextSubQuery.getId());
      if (LOG.isDebugEnabled()) {
        LOG.debug("Scheduling SubQuery's Priority: " + nextSubQuery.getPriority());
        LOG.debug("Scheduling SubQuery's Plan: \n" + nextSubQuery.getBlock().getPlan());
      }
    }
Example #3
0
    @Override
    public void transition(Query query, QueryEvent queryEvent) {
      query.setStartTime();
      SubQuery subQuery =
          new SubQuery(
              query.context,
              query.getPlan(),
              query.getExecutionBlockCursor().nextBlock(),
              query.sm);
      subQuery.setPriority(query.priority--);
      query.addSubQuery(subQuery);

      subQuery.handle(new SubQueryEvent(subQuery.getId(), SubQueryEventType.SQ_INIT));
      LOG.debug("Schedule unit plan: \n" + subQuery.getBlock().getPlan());
    }
Example #4
0
 private boolean hasNext(Query query) {
   ExecutionBlockCursor cursor = query.getExecutionBlockCursor();
   ExecutionBlock nextBlock = cursor.peek();
   return !query.getPlan().isTerminal(nextBlock);
 }