def _applyQueryFromFile(self, filename): x = self._readFile(filename) if x: a = app.AppInterface() q = x result = a.queryNow(q, self._makeBadHint()) print result
def testAvgQuery(self): a = app.AppInterface() id1 = a.query(*self.hintQuery2) id2 = a.query(*self.aggQuery2) r1 = a.joinQuery(id1) r2 = a.joinQuery(id2) print "Done aggregate query." print a.resultTableString(r1) print a.resultTableString(r2)
def testParallelQuery2(self): a = app.AppInterface() id1 = a.query(*self.basicQuery) id2 = a.query(*self.hintQuery2) r1 = a.joinQuery(id1) print "Done fullsky query." print a.resultTableString(r1) r2 = a.joinQuery(id2) print "Done hinted query." print a.resultTableString(r2)
def main(): parser = OptionParser() parser.add_option("--qhelp", action="store_true", dest="appHelp", default=False, help="Get qserv frontend help.") parser.add_option("-c", "--config", dest="configFile", default=None, help="Use config file. Can also be specified with\n" + "%s as an environment variable." % config.envFilenameVar) parser.add_option("--check", dest="checkTaskId", default=None, metavar="ID", help="Check status of task with id ID.") parser.add_option("-q", "--query", dest="queryFile", default=None, metavar="FILENAME", help="Invoke a query stored in FILENAME.\n" + "'-' will read from standard input.") parser.add_option("--hintfile", dest="queryHints", default=None, metavar="FILENAME", help="Use FILENAME to get hints. Use with --query.") parser.add_option("--hintTest", dest="hintTest", default=None, metavar="NAME", help="Run a hintedParser test named NAME.") parser.add_option("--test", dest="testName", default=None, metavar="NAME", help="Run a appInterface test named NAME.") (options, args) = parser.parse_args() # Modifying options if options.configFile: config.load(options.configFile) else: config.load() print "Configuration:" config.printTo(sys.stdout) # Action options if options.appHelp == True: a = app.AppInterface() print a.help() return elif options.checkTaskId: a = app.AppInterface() print a.check(options.checkTaskId) return elif options.queryFile: q = options.queryFile a = app.AppInterface() # don't use hints right now. if q == "-": q = "" for l in sys.stdin: q += l else: q = open(options.queryFile).read() print a.query(q) return elif options.testName: suite = unittest.TestSuite() suite.addTest(TestAppInterface('test' + options.testName)) unittest.TextTestRunner(verbosity=2).run(suite) elif options.hintTest: # from lsst.qserv.master import testHintedParser # t = testHintedParser.TestHintedParser() suite = unittest.TestSuite() suite.addTest(TestHintedParser('test' + options.hintTest)) unittest.TextTestRunner(verbosity=2).run(suite) else: print "No action specified. Need --help ?" pass return
def testNnQuery(self): a = app.AppInterface() id1 = a.query(*self.nearNeighQuery1) r1 = a.joinQuery(id1) print "Done near neighbor query." print a.resultTableString(r1)
def testGroupByQuery(self): a = app.AppInterface() id1 = a.query(*self.groupByQuery1) r1 = a.joinQuery(id1) print "Done avg groupby query." print a.resultTableString(r1)
def _performTestQueryAction(self, queryTuple): a = app.AppInterface() result = a.queryNow(*queryTuple) print "Done Query." print result pass