12 import sys, getopt, os
17 if len(arguments) <= 1:
18 print(
'No query argument given')
23 if arguments[1] ==
'fileindex':
24 installpath =
'/'.
join(os.path.dirname(__file__).
split(
'/')[:-1])
25 fileindex = arguments[2]
26 datapath =
'/data/arq_%s/arq_%s' % (fileindex[:6],fileindex)
28 queryfile =
'%s/query.txt' % datapath
29 fh =
open(queryfile,
"r")
30 origQuery = fh.readline().strip()
32 arguments[1:] = origQuery.split()
35 origQuery =
' '.
join(arguments[1:])
37 ignoreParser = origQuery.startswith(
'--')
39 from CoolRunQuery.AtlRunQueryOptions
import AtlRunQueryOptions
42 (options, args) = AtlRunQueryOptions().
parse()
43 atlqueryarg = origQuery
47 from CoolRunQuery.AtlRunQueryParser
import ArgumentParser
51 firstarg = arguments[1].lower()
52 if firstarg
in [
'pileup',
'detmask',
'help']:
53 tabletemplate =
'<table class="othertable" style="width:60%%"><tr><th>Query result:</th></tr><tr><td>\n%s</td></tr></table><p></p><br><p></p>'
54 if firstarg ==
'pileup':
55 from CoolRunQuery.AtlRunQueryUtils
import Pileup
56 body = tabletemplate % (
Pileup(arguments[2:]))
57 elif firstarg ==
'detmask':
58 from CoolRunQuery.utils.AtlRunQueryLookup
import DecodeDetectorMask
64 from CoolRunQuery.html.AtlRunQueryPageMaker
import PageMaker
65 from CoolRunQuery.AtlRunQueryQueryConfig
import QC
66 QC.datapath = datapath
67 PageMaker.makePage(body, origQuery, removeExamples=
True)
70 atlqueryarg = arguments[0].rsplit(
'/',1)[-1] +
" " + ap.ParseArgument(
' '.
join(arguments[1:]) )
72 if '--verbose' in atlqueryarg:
75 (options, args) = AtlRunQueryOptions().
parse(atlqueryarg)
78 from CoolRunQuery.AtlRunQueryLib
import AtlRunQuery
79 print(
"Data path %s" % datapath)
80 AtlRunQuery(options, html=
"AUTO", origQuery=origQuery, datapath=datapath, parsedstring=atlqueryarg)
83 if __name__ ==
'__main__':