void scheduleQueries(TaskGraph::Node taskId, uint32_t queryType, Scheduler& scheduler, ScheduleGraph& taskGraph, queryfiles::QueryBatcher& batches,
   runtime::QueryState& queryState, bool logScheduling) {
      // Schedule query tasks
      TaskGroup queryTasks;
      unsigned count=0;
      auto taskBatches=batches.getBatches(queryType);
      for(auto batchIter=taskBatches.begin(); batchIter!=taskBatches.end(); batchIter++) {
         queryfiles::QueryBatch* batch = *batchIter;
         assert(batch->queryType==queryType);

         queryTasks.schedule(LambdaRunner::createLambdaTask(RunBatch(scheduler, taskGraph, taskId, queryState, batch), taskId));
         count++;
      }

      queryTasks.join(LambdaRunner::createLambdaTask(UpdateTask(taskGraph, taskId),taskId));

      if(logScheduling) {
      	assert(batches.batchCounts[queryType]==count);
      	LOG_PRINT("[Queries] Schedule " << count << " of type: "<< queryType);
      }

      // Disable early close
      taskGraph.updateTask(taskId, 1);
      if(taskId==TaskGraph::Query1) {
         scheduler.schedule(queryTasks.close(), Priorities::LOW, false);
      } else {
         scheduler.schedule(queryTasks.close(), Priorities::CRITICAL, false);
      }
}
logical DLInterpreter :: ExecuteCommands ( )
{
  char                    procname[ID_SIZE+2];
  char                   *name;
  logical                 term = NO;
//  if ( echo )
  ShowCurrentLine();

  if ( name = current_node->GetAutoRun() )
  {
    memset(procname,0,sizeof(procname));
    procname[0] = '@';
    strncpy(procname+1,name,ID_SIZE);
    RunBatch(procname);
    top_cmdline = this;
  }
  
  run_option = NO;
  while ( GetConsoleCommand() )
    if ( *GetCommand() )
      if ( ExecuteCommand() || run_option )
        break;

  return(term);
}