private synchronized boolean executeNextBlock(Query query, ExecutionBlockId blockId) { ExecutionQueue cursor = query.getExecutionQueue(); ExecutionBlock[] nextBlocks = cursor.next(blockId); if (nextBlocks == null || nextBlocks.length == 0) { return nextBlocks == null; } boolean terminal = true; for (ExecutionBlock nextBlock : nextBlocks) { if (query.getPlan().isTerminal(nextBlock)) { continue; } Stage nextStage = new Stage(query.context, query.getPlan(), nextBlock); nextStage.setPriority(query.priority--); query.addStage(nextStage); nextStage.getEventHandler().handle(new StageEvent(nextStage.getId(), StageEventType.SQ_INIT)); LOG.info("Scheduling Stage:" + nextStage.getId()); if (LOG.isDebugEnabled()) { LOG.debug("Scheduling Stage's Priority: " + nextStage.getPriority()); LOG.debug("Scheduling Stage's Plan: \n" + nextStage.getBlock().getPlan()); } terminal = false; } return terminal; }
private synchronized boolean executeNextBlock(Query query, ExecutionBlockId blockId) { ExecutionQueue cursor = query.getExecutionQueue(); ExecutionBlock[] nextBlocks = cursor.next(blockId); if (nextBlocks == null || nextBlocks.length == 0) { return nextBlocks == null; } boolean terminal = true; for (ExecutionBlock nextBlock : nextBlocks) { if (query.getPlan().isTerminal(nextBlock)) { continue; } Stage nextStage = new Stage(query.context, query.getPlan(), nextBlock); nextStage.setPriority(query.priority--); query.addStage(nextStage); nextStage.getEventHandler().handle(new StageEvent(nextStage.getId(), StageEventType.SQ_INIT)); LOG.info("Scheduling Stage:" + nextStage.getId()); if (LOG.isDebugEnabled()) { LOG.debug("Scheduling Stage's Priority: " + nextStage.getPriority()); LOG.debug("Scheduling Stage's Plan: \n" + nextStage.getBlock().getPlan()); } terminal = false; } return terminal; }
@Override public void transition(Query query, QueryEvent queryEvent) { query.setStartTime(); ExecutionQueue executionQueue = query.newExecutionQueue(); for (ExecutionBlock executionBlock : executionQueue.first()) { Stage stage = new Stage(query.context, query.getPlan(), executionBlock); stage.setPriority(query.priority--); query.addStage(stage); stage.getEventHandler().handle(new StageEvent(stage.getId(), StageEventType.SQ_INIT)); LOG.debug("Schedule unit plan: \n" + stage.getBlock().getPlan()); } } }
@Override public void transition(Query query, QueryEvent queryEvent) { query.setStartTime(); ExecutionQueue executionQueue = query.newExecutionQueue(); for (ExecutionBlock executionBlock : executionQueue.first()) { Stage stage = new Stage(query.context, query.getPlan(), executionBlock); stage.setPriority(query.priority--); query.addStage(stage); stage.getEventHandler().handle(new StageEvent(stage.getId(), StageEventType.SQ_INIT)); LOG.debug("Schedule unit plan: \n" + stage.getBlock().getPlan()); } } }