CMS 3D CMS Logo

Classes | Functions
confdbOfflineConverter Namespace Reference

Classes

class  OfflineConverter
 

Functions

def help ()
 
def main ()
 

Function Documentation

◆ help()

def confdbOfflineConverter.help ( )

Definition at line 183 of file confdbOfflineConverter.py.

183 def help():
184  sys.stdout.write("""Usage: %s OPTIONS
185 
186  --v1|--v2|--v3|--v3-beta|--v3-test (specify the ConfDB version [default: v3])
187 
188  --run3|--run2|--dev|--online|--adg (specify the target db [default: run3], online will only work inside p5 network)
189 
190  Note that for v1
191  --orcoff is a synonim of --adg
192  --offline is a synonim of --hltdev
193 
194  --configId <id> (specify the configuration by id)
195  --configName <name> (specify the configuration by name)
196  --runNumber <run> (specify the configuration by run number)
197  [exactly one of --configId OR --configName OR --runNumber is required]
198 
199  --cff (retrieve configuration *fragment*)
200  --input <f1.root[,f2.root]> (insert PoolSource with specified fileNames)
201  --input <files.list> (read a text file which lists input ROOT files)
202  --output <out.root> (insert PoolOutputModule w/ specified fileName)
203  --nopsets (exclude all globale psets)
204  --noedsources (exclude all edsources)
205  --noes (exclude all essources *and* esmodules)
206  --noessources (exclude all essources)
207  --noesmodules (exclude all esmodules)
208  --noservices (exclude all services)
209  --nooutput (exclude all output modules)
210  --nopaths (exclude all paths [+=referenced seqs&mods])
211  --nosequences (don't define sequences [+=referenced s&m])
212  --nomodules (don't define modules)
213  --psets <pset1[,pset2]> (include only specified global psets)
214  --psets <-pset1[,-pset2]> (include all global psets but the specified)
215  --essources <ess1[,ess2]> (include only specified essources)
216  --essources <-ess1[,-ess2]> (include all essources but the specified)
217  --esmodules <esm1[,esm2]> (include only specified esmodules)
218  --esmodules <-esm1[,-esm2]> (include all esmodules but the specified)
219  --services <svc1[,svc2]> (include only specified services)
220  --services <-svc1[,-svc2]> (include all services but the specified)
221  --paths <p1[,p2]> (include only specified paths)
222  --paths <-p1[,-p2]> (include all paths but the specified)
223  --streams <s1[,s2]> (include only specified streams)
224  --datasets <d1[,d2]> (include only specified datasets)
225  --sequences <s1[,s2]> (include sequences, referenced or not!)
226  --modules <p1[,p2]> (include modules, referenced or not!)
227  --blocks <m1::p1[,p2][,m2]> (generate parameter blocks)
228 
229  --verbose (print additional details)
230 """)
231 
232 

Referenced by main().

◆ main()

def confdbOfflineConverter.main ( )

Definition at line 233 of file confdbOfflineConverter.py.

233 def main():
234  args = sys.argv[1:]
235  version = 'v3'
236  db = 'run3'
237  verbose = False
238 
239  if not args:
240  help()
241  sys.exit(1)
242 
243  if '--help' in args or '-h' in args:
244  help()
245  sys.exit(0)
246 
247  if '--verbose' in args:
248  verbose = True
249  args.remove('--verbose')
250 
251  arg_count = Counter(args)
252  db_count = arg_count['--v1'] + arg_count['--v2'] + arg_count['--v3'] + arg_count['--v3-beta'] + arg_count['--v3-test']
253  if db_count>1:
254  sys.stderr.write( 'ERROR: conflicting database version specifications: "--v1", "--v2", "--v3", "--v3-beta", and "--v3-test" are mutually exclusive options' )
255  sys.exit(1)
256 
257  if '--v1' in args:
258  version = 'v1'
259  db = 'offline'
260  args.remove('--v1')
261 
262  if '--v2' in args:
263  version = 'v2'
264  db = 'run2'
265  args.remove('--v2')
266 
267  if '--v3' in args:
268  version = 'v3'
269  db = 'run3'
270  args.remove('--v3')
271 
272  if '--v3-beta' in args:
273  version = 'v3-beta'
274  db = 'run3'
275  args.remove('--v3-beta')
276 
277  if '--v3-test' in args:
278  version = 'v3-test'
279  db = 'dev'
280  args.remove('--v3-test')
281 
282  proxy=False
283  proxy_host = "localhost"
284  proxy_port = "8080"
285  if '--dbproxy' in args:
286  proxy = True
287  args.remove('--dbproxy')
288  if '--dbproxyhost' in args:
289  proxy_host = args.pop(args.index('--dbproxyhost')+1)
290  args.remove('--dbproxyhost')
291  if '--dbproxyport' in args:
292  proxy_port = args.pop(args.index('--dbproxyport')+1)
293  args.remove('--dbproxyport')
294 
295 
296  _dbs = {}
297  _dbs['v1'] = [ '--%s' % _db for _db in OfflineConverter.databases['v1'] ] + [ '--runNumber' ]
298  _dbs['v2'] = [ '--%s' % _db for _db in OfflineConverter.databases['v2'] ] + [ '--runNumber' ]
299  _dbs['v3'] = [ '--%s' % _db for _db in OfflineConverter.databases['v3'] ] + [ '--runNumber']
300  _dbs['v3-beta'] = [ '--%s' % _db for _db in OfflineConverter.databases['v3-beta'] ] + [ '--runNumber' ]
301  _dbs['v3-test'] = [ '--%s' % _db for _db in OfflineConverter.databases['v3-test'] ] + [ '--runNumber' ]
302  _dbargs = set(args) & set(sum(_dbs.values(), []))
303 
304  if _dbargs:
305  if len(_dbargs) > 1:
306  sys.stderr.write( "ERROR: too many database specifications: \"" + "\", \"".join( _dbargs) + "\"\n" )
307  sys.exit(1)
308 
309  _arg = _dbargs.pop()
310  db = _arg[2:]
311  if db == 'runNumber':
312  db = 'adg'
313  else:
314  args.remove(_arg)
315 
316  if not db in OfflineConverter.databases[version]:
317  sys.stderr.write( "ERROR: database version \"%s\" incompatible with specification \"%s\"\n" % (version, db) )
318  sys.exit(1)
319 
320  converter = OfflineConverter(version = version, database = db, verbose = verbose,
321  proxy = proxy, proxyHost = proxy_host, proxyPort=proxy_port)
322  out, err = converter.query( * args )
323  if 'ERROR' in err:
324  sys.stderr.write( "%s: error while retriving the HLT menu\n\n%s\n\n" % (sys.argv[0], err) )
325  sys.exit(1)
326  else:
327  sys.stdout.write( out )
328 
329 

References help(), and join().

align::Counter
std::function< unsigned int(align::ID)> Counter
Definition: AlignableIndexer.h:31
join
static std::string join(char **cmd)
Definition: RemoteFile.cc:17
confdbOfflineConverter.main
def main()
Definition: confdbOfflineConverter.py:233
confdbOfflineConverter.help
def help()
Definition: confdbOfflineConverter.py:183