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)
65 if os.path.exists(self.
workDir +
'/' + jar):
68 handle, temp = tempfile.mkstemp(dir = self.
workDir, prefix = jar +
'.')
70 urllib.urlretrieve(self.
baseUrl +
'/' + jar, temp)
71 if not os.path.exists(self.
workDir +
'/' + jar):
72 os.rename(temp, self.
workDir +
'/' + jar)
78 sys.stderr.write(
"workDir = %s\n" % self.
workDir)
83 self.
javaCmd = (
'java',
'-cp',
':'.
join(self.
workDir +
'/' + jar
for jar
in self.
jars),
'-Djava.security.egd=file:///dev/urandom',
'-Doracle.jdbc.timezoneAsRegion=false',
'confdb.converter.BrowserConverter' )
89 sys.stderr.write(
"\n" +
' '.
join(args) +
"\n\n" )
90 sub = subprocess.Popen(
93 stdout = subprocess.PIPE,
94 stderr = subprocess.PIPE,
96 universal_newlines =
True )
97 return sub.communicate()
100 sys.stdout.write(
"""Usage: %s OPTIONS
102 --hltdev|--orcoff (target db [default: hltdev])
104 --configId <id> (specify configuration by id)
105 --configName <name> (specify configuration by name)
106 --runNumber <run> (specify configuration by run)
107 [exactly one of --configId OR --configName OR --runNumber is required]
109 --cff (retrieve configuration *fragment*)
110 --input <f1.root[,f2.root]> (insert PoolSource with specified fileNames)
111 --input <files.list> (read a text file which lists input ROOT files)
112 --output <out.root> (insert PoolOutputModule w/ specified fileName)
113 --nopsets (exclude all globale psets)
114 --noedsources (exclude all edsources)
115 --noes (exclude all essources *and* esmodules)
116 --noessources (exclude all essources)
117 --noesmodules (exclude all esmodules)
118 --noservices (exclude all services)
119 --nooutput (exclude all output modules)
120 --nopaths (exclude all paths [+=referenced seqs&mods])
121 --nosequences (don't define sequences [+=referenced s&m])
122 --nomodules (don't define modules)
123 --psets <pset1[,pset2]> (include only specified global psets)
124 --psets <-pset1[,-pset2]> (include all global psets but the specified)
125 --essources <ess1[,ess2]> (include only specified essources)
126 --essources <-ess1[,-ess2]> (include all essources but the specified)
127 --esmodules <esm1[,esm2]> (include only specified esmodules)
128 --esmodules <-esm1[,-esm2]> (include all esmodules but the specified)
129 --services <svc1[,svc2]> (include only specified services)
130 --services <-svc1[,-svc2]> (include all services but the specified)
131 --paths <p1[,p2]> (include only specified paths)
132 --paths <-p1[,-p2]> (include all paths but the specified)
133 --streams <s1[,s2]> (include only specified streams)
134 --datasets <d1[,d2]> (include only specified datasets)
135 --sequences <s1[,s2]> (include sequences, referenced or not!)
136 --modules <p1[,p2]> (include modules, referenced or not!)
137 --blocks <m1::p1[,p2][,m2]> (generate parameter blocks)
149 if '--help' in args
or '-h' in args:
153 if '--orcoff' in args
and '--hltdev' in args:
154 sys.stderr.write(
"ERROR: conflicting database specifications \"--hltdev\" and \"--orcoff\"\n" )
157 if '--runNumber' in args
and '--hltdev' in args:
158 sys.stderr.write(
"ERROR: conflicting database specifications \"--hltdev\" and \"--runNumber\"\n" )
161 if '--hltdev' in args:
163 args.remove(
'--hltdev')
165 if '--orcoff' in args:
167 args.remove(
'--orcoff')
169 if '--runNumber' in args:
173 out, err = converter.query( * args )
175 sys.stderr.write(
"%s: error while retriving the HLT menu\n\n%s\n\n" % (sys.argv[0], err) )
178 sys.stdout.write( out )
181 if __name__ ==
"__main__":
static std::string join(char **cmd)