13 databases[
'orcoff'] = (
'-t',
'oracle',
'-h',
'cmsr1-s.cern.ch',
'-d',
'cms_cond.cern.ch',
'-u',
'cms_hlt_gui_r',
'-s',
'convertme!' )
14 databases[
'hltdev'] = (
'-t',
'oracle',
'-h',
'cmsr1-s.cern.ch',
'-d',
'cms_cond.cern.ch',
'-u',
'cms_hltdev_reader',
'-s',
'convertme!' )
19 dir = os.path.realpath(dir)
20 if not os.path.isdir(dir):
28 def __init__(self, database = 'hltdev', url = None, verbose = False):
30 self.
baseDir =
'/afs/cern.ch/user/c/confdb/www/lib'
31 self.
baseUrl =
'http://confdb.web.cern.ch/confdb/lib'
32 self.
jars = (
'ojdbc6.jar',
'cmssw-evf-confdb-converter.jar' )
41 sys.stderr.write(
"ERROR: unknown database \"%s\"\n" % database)
49 if os.path.isdir(self.
baseDir)
and all(os.path.isfile(self.
baseDir +
'/' + jar)
for jar
in self.
jars):
54 self.
workDir = OfflineConverter.CheckTempDirectory(os.environ[
'CMSSW_BASE'] +
'/tmp/confdb')
57 self.
workDir = OfflineConverter.CheckTempDirectory(os.environ[
'TMP'] +
'/confdb')
60 self.
workDir = tempfile.mkdtemp()
61 atexit.register(shutil.rmtree, self.
workDir)
64 urllib.urlretrieve(self.
baseUrl +
'/' + jar, self.
workDir +
'/' + jar)
68 sys.stderr.write(
"workDir = %s\n" % self.
workDir)
69 self.
javaCmd = (
'java',
'-cp',
':'.
join(self.
workDir +
'/' + jar
for jar
in self.
jars),
'confdb.converter.BrowserConverter' )
75 sys.stderr.write(
"\n" +
' '.
join(args) +
"\n\n" )
76 sub = subprocess.Popen(
79 stdout = subprocess.PIPE,
80 stderr = subprocess.PIPE,
82 universal_newlines =
True )
83 return sub.communicate()
86 sys.stdout.write(
"""Usage: %s OPTIONS
88 --hltdev|--orcoff (target db [default: hltdev])
90 --configId <id> (specify configuration by id)
91 --configName <name> (specify configuration by name)
92 --runNumber <run> (specify configuration by run)
93 [exactly one of --configId OR --configName OR --runNumber is required]
95 --cff (retrieve configuration *fragment*)
96 --input <f1.root[,f2.root]> (insert PoolSource with specified fileNames)
97 --input <files.list> (read a text file which lists input ROOT files)
98 --output <out.root> (insert PoolOutputModule w/ specified fileName)
99 --nopsets (exclude all globale psets)
100 --noedsources (exclude all edsources)
101 --noes (exclude all essources *and* esmodules)
102 --noessources (exclude all essources)
103 --noesmodules (exclude all esmodules)
104 --noservices (exclude all services)
105 --nooutput (exclude all output modules)
106 --nopaths (exclude all paths [+=referenced seqs&mods])
107 --nosequences (don't define sequences [+=referenced s&m])
108 --nomodules (don't define modules)
109 --psets <pset1[,pset2]> (include only specified global psets)
110 --psets <-pset1[,-pset2]> (include all global psets but the specified)
111 --essources <ess1[,ess2]> (include only specified essources)
112 --essources <-ess1[,-ess2]> (include all essources but the specified)
113 --esmodules <esm1[,esm2]> (include only specified esmodules)
114 --esmodules <-esm1[,-esm2]> (include all esmodules but the specified)
115 --services <svc1[,svc2]> (include only specified services)
116 --services <-svc1[,-svc2]> (include all services but the specified)
117 --paths <p1[,p2]> (include only specified paths)
118 --paths <-p1[,-p2]> (include all paths but the specified)
119 --streams <s1[,s2]> (include only specified streams)
120 --datasets <d1[,d2]> (include only specified datasets)
121 --sequences <s1[,s2]> (include sequences, referenced or not!)
122 --modules <p1[,p2]> (include modules, referenced or not!)
123 --blocks <m1::p1[,p2][,m2]> (generate parameter blocks)
135 if '--help' in args
or '-h' in args:
139 if '--orcoff' in args
and '--hltdev' in args:
140 sys.stderr.write(
"ERROR: conflicting database specifications \"--hltdev\" and \"--orcoff\"\n" )
143 if '--runNumber' in args
and '--hltdev' in args:
144 sys.stderr.write(
"ERROR: conflicting database specifications \"--hltdev\" and \"--runNumber\"\n" )
147 if '--hltdev' in args:
149 args.remove(
'--hltdev')
151 if '--orcoff' in args:
153 args.remove(
'--orcoff')
155 if '--runNumber' in args:
159 out, err = converter.query( * args )
161 sys.stderr.write(
"%s: error while retriving the HLT menu\n\n%s\n\n" % (sys.argv[0], err) )
164 sys.stdout.write( out )
167 if __name__ ==
"__main__":
static std::string join(char **cmd)