30 databases[
'v1'][
'offline'] = (
'-t',
'oracle',
'-h',
'cmsr1-s.cern.ch',
'-d',
'cms_cond.cern.ch',
'-u',
'cms_hltdev_reader',
'-s',
'convertme!' )
31 databases[
'v1'][
'hltdev'] = databases[
'v1'][
'offline']
32 databases[
'v1'][
'online'] = (
'-t',
'oracle',
'-h',
'cmsonr1-s.cms',
'-d',
'cms_rcms.cern.ch',
'-u',
'cms_hlt_r',
'-s',
'convertme!' )
33 databases[
'v1'][
'adg'] = (
'-t',
'oracle',
'-h',
'cmsr1-s.cern.ch',
'-d',
'cms_cond.cern.ch',
'-u',
'cms_hlt_gui_r',
'-s',
'convertme!' )
34 databases[
'v1'][
'orcoff'] = databases[
'v1'][
'adg']
36 databases[
'v2'][
'offline'] = (
'-t',
'oracle',
'-h',
'cmsr1-s.cern.ch',
'-d',
'cms_cond.cern.ch',
'-u',
'cms_hlt_gdr_r',
'-s',
'convertme!' )
37 databases[
'v2'][
'online'] = (
'-t',
'oracle',
'-h',
'cmsonr1-s.cms',
'-d',
'cms_rcms.cern.ch',
'-u',
'cms_hlt_gdr_r',
'-s',
'convertme!' )
38 databases[
'v2'][
'adg'] = (
'-t',
'oracle',
'-h',
'cmsonradg1-s.cern.ch',
'-d',
'cms_orcon_adg.cern.ch',
'-u',
'cms_hlt_gdr_r',
'-s',
'convertme!' )
43 dir = os.path.realpath(dir)
44 if not os.path.isdir(dir):
52 def __init__(self, version = 'v2', database = 'offline', url = None, verbose = False):
55 self.
baseDir =
'/afs/cern.ch/user/c/confdb/www/%s/lib' % version
56 self.
baseUrl =
'http://confdb.web.cern.ch/confdb/%s/lib' % version
57 self.
jars = (
'ojdbc6.jar',
'cmssw-evf-confdb-converter.jar' )
63 sys.stderr.write(
"ERROR: unsupported database version \"%s\"\n" % version)
71 sys.stderr.write(
"ERROR: unknown database \"%s\" for version \"%s\"\n" % (database, version))
79 if os.path.isdir(self.
baseDir)
and all(os.path.isfile(self.
baseDir +
'/' + jar)
for jar
in self.
jars):
84 self.
workDir = OfflineConverter.CheckTempDirectory(os.environ[
'CMSSW_BASE'] +
'/tmp/confdb')
87 self.
workDir = OfflineConverter.CheckTempDirectory(os.environ[
'TMP'] +
'/confdb')
90 self.
workDir = tempfile.mkdtemp()
91 atexit.register(shutil.rmtree, self.
workDir)
95 if os.path.exists(self.
workDir +
'/' + jar):
98 handle, temp = tempfile.mkstemp(dir = self.
workDir, prefix = jar +
'.')
100 urllib.urlretrieve(self.
baseUrl +
'/' + jar, temp)
101 if not os.path.exists(self.
workDir +
'/' + jar):
102 os.rename(temp, self.
workDir +
'/' + jar)
108 sys.stderr.write(
"workDir = %s\n" % self.
workDir)
115 self.
javaCmd = (
'java',
'-cp',
':'.
join(self.
workDir +
'/' + jar
for jar
in self.
jars),
'-Djava.security.egd=file:///dev/urandom',
'-Doracle.jdbc.timezoneAsRegion=false',
'-Xss32M',
'confdb.converter.BrowserConverter' )
121 sys.stderr.write(
"\n" +
' '.
join(args) +
"\n\n" )
122 sub = subprocess.Popen(
125 stdout = subprocess.PIPE,
126 stderr = subprocess.PIPE,
128 universal_newlines =
True )
129 return sub.communicate()
132 sys.stdout.write(
"""Usage: %s OPTIONS
134 --v1|--v2 (specify the ConfDB version [default: v2])
136 --offline|--online|--adg (specify the target db [default: offline])
139 --orcoff is a synonim of --adg
140 --offline is a synonim of --hltdev
142 --configId <id> (specify the configuration by id)
143 --configName <name> (specify the configuration by name)
144 --runNumber <run> (specify the configuration by run number)
145 [exactly one of --configId OR --configName OR --runNumber is required]
147 --cff (retrieve configuration *fragment*)
148 --input <f1.root[,f2.root]> (insert PoolSource with specified fileNames)
149 --input <files.list> (read a text file which lists input ROOT files)
150 --output <out.root> (insert PoolOutputModule w/ specified fileName)
151 --nopsets (exclude all globale psets)
152 --noedsources (exclude all edsources)
153 --noes (exclude all essources *and* esmodules)
154 --noessources (exclude all essources)
155 --noesmodules (exclude all esmodules)
156 --noservices (exclude all services)
157 --nooutput (exclude all output modules)
158 --nopaths (exclude all paths [+=referenced seqs&mods])
159 --nosequences (don't define sequences [+=referenced s&m])
160 --nomodules (don't define modules)
161 --psets <pset1[,pset2]> (include only specified global psets)
162 --psets <-pset1[,-pset2]> (include all global psets but the specified)
163 --essources <ess1[,ess2]> (include only specified essources)
164 --essources <-ess1[,-ess2]> (include all essources but the specified)
165 --esmodules <esm1[,esm2]> (include only specified esmodules)
166 --esmodules <-esm1[,-esm2]> (include all esmodules but the specified)
167 --services <svc1[,svc2]> (include only specified services)
168 --services <-svc1[,-svc2]> (include all services but the specified)
169 --paths <p1[,p2]> (include only specified paths)
170 --paths <-p1[,-p2]> (include all paths but the specified)
171 --streams <s1[,s2]> (include only specified streams)
172 --datasets <d1[,d2]> (include only specified datasets)
173 --sequences <s1[,s2]> (include sequences, referenced or not!)
174 --modules <p1[,p2]> (include modules, referenced or not!)
175 --blocks <m1::p1[,p2][,m2]> (generate parameter blocks)
177 --verbose (print additional details)
191 if '--help' in args
or '-h' in args:
195 if '--verbose' in args:
197 args.remove(
'--verbose')
199 if '--v1' in args
and '--v2' in args:
200 sys.stderr.write(
"ERROR: conflicting database version specifications \"--v1\" and \"--v2\"\n" )
214 _dbs[
'v1'] = [
'--%s' % _db
for _db
in OfflineConverter.databases[
'v1'] ] + [
'--runNumber' ]
215 _dbs[
'v2'] = [
'--%s' % _db
for _db
in OfflineConverter.databases[
'v2'] ] + [
'--runNumber' ]
216 _dbargs = set(args) & set(sum(_dbs.values(), []))
220 sys.stderr.write(
"ERROR: too many database specifications: \"" +
"\", \"".
join( _dbargs) +
"\"\n" )
225 if db ==
'runNumber':
230 if not db
in OfflineConverter.databases[version]:
231 sys.stderr.write(
"ERROR: database version \"%s\" incompatible with specification \"%s\"\n" % (version, db) )
234 converter =
OfflineConverter(version = version, database = db, verbose = verbose)
235 out, err = converter.query( * args )
237 sys.stderr.write(
"%s: error while retriving the HLT menu\n\n%s\n\n" % (sys.argv[0], err) )
240 sys.stdout.write( out )
243 if __name__ ==
"__main__":
static std::string join(char **cmd)