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 199 of file confdbOfflineConverter.py.

Referenced by main().

199 def help():
200  sys.stdout.write("""Usage: %s OPTIONS
201 
202  --v1|--v2|--v3|--v3-beta|--v3-test (specify the ConfDB version [default: v3])
203 
204  --run3|--run2|--dev|--online|--adg (specify the target db [default: run3], online will only work inside p5 network)
205 
206  Note that for v1
207  --orcoff is a synonim of --adg
208  --offline is a synonim of --hltdev
209 
210  --configId <id> (specify the configuration by id)
211  --configName <name> (specify the configuration by name)
212  --runNumber <run> (specify the configuration by run number)
213  [exactly one of --configId OR --configName OR --runNumber is required]
214 
215  --cff (retrieve configuration *fragment*)
216  --input <f1.root[,f2.root]> (insert PoolSource with specified fileNames)
217  --input <files.list> (read a text file which lists input ROOT files)
218  --output <out.root> (insert PoolOutputModule w/ specified fileName)
219  --nopsets (exclude all globale psets)
220  --noedsources (exclude all edsources)
221  --noes (exclude all essources *and* esmodules)
222  --noessources (exclude all essources)
223  --noesmodules (exclude all esmodules)
224  --noservices (exclude all services)
225  --nooutput (exclude all output modules)
226  --nopaths (exclude all paths [+=referenced seqs&mods])
227  --nosequences (don't define sequences [+=referenced s&m])
228  --nomodules (don't define modules)
229  --psets <pset1[,pset2]> (include only specified global psets)
230  --psets <-pset1[,-pset2]> (include all global psets but the specified)
231  --essources <ess1[,ess2]> (include only specified essources)
232  --essources <-ess1[,-ess2]> (include all essources but the specified)
233  --esmodules <esm1[,esm2]> (include only specified esmodules)
234  --esmodules <-esm1[,-esm2]> (include all esmodules but the specified)
235  --services <svc1[,svc2]> (include only specified services)
236  --services <-svc1[,-svc2]> (include all services but the specified)
237  --paths <p1[,p2]> (include only specified paths)
238  --paths <-p1[,-p2]> (include all paths but the specified)
239  --streams <s1[,s2]> (include only specified streams)
240  --datasets <d1[,d2]> (include only specified datasets)
241  --sequences <s1[,s2]> (include sequences, referenced or not!)
242  --modules <p1[,p2]> (include modules, referenced or not!)
243  --blocks <m1::p1[,p2][,m2]> (generate parameter blocks)
244 
245  Options to connect to target db via SOCKS proxy, or direct tunnel:
246  [the options --dbproxy and --dbtunnel are mutually exclusive]
247  --dbproxy (use a SOCKS proxy to connect outside CERN network [default: False])
248  --dbproxyhost <hostname> (host of the SOCKS proxy [default: "localhost"])
249  --dbproxyport <port> (port of the SOCKS proxy [default: 8080])
250  --dbtunnel (use direct tunnel to connect outside CERN network [default: False])
251  --dbtunnelport <port> (port when using a direct tunnel on localhost [default: 10121])
252 
253  --verbose (print additional details)
254 """)
255 
256 

◆ main()

def confdbOfflineConverter.main ( )

Definition at line 257 of file confdbOfflineConverter.py.

References help(), and join().

257 def main():
258  args = sys.argv[1:]
259  version = 'v3'
260  db = 'run3'
261  verbose = False
262 
263  if not args:
264  help()
265  sys.exit(1)
266 
267  if '--help' in args or '-h' in args:
268  help()
269  sys.exit(0)
270 
271  if '--verbose' in args:
272  verbose = True
273  args.remove('--verbose')
274 
275  arg_count = Counter(args)
276  db_count = arg_count['--v1'] + arg_count['--v2'] + arg_count['--v3'] + arg_count['--v3-beta'] + arg_count['--v3-test']
277  if db_count>1:
278  sys.stderr.write( 'ERROR: conflicting database version specifications: "--v1", "--v2", "--v3", "--v3-beta", and "--v3-test" are mutually exclusive options' )
279  sys.exit(1)
280 
281  if '--v1' in args:
282  version = 'v1'
283  db = 'offline'
284  args.remove('--v1')
285 
286  if '--v2' in args:
287  version = 'v2'
288  db = 'run2'
289  args.remove('--v2')
290 
291  if '--v3' in args:
292  version = 'v3'
293  db = 'run3'
294  args.remove('--v3')
295 
296  if '--v3-beta' in args:
297  version = 'v3-beta'
298  db = 'run3'
299  args.remove('--v3-beta')
300 
301  if '--v3-test' in args:
302  version = 'v3-test'
303  db = 'dev'
304  args.remove('--v3-test')
305 
306  proxy = False
307  proxy_host = "localhost"
308  proxy_port = "8080"
309  if '--dbproxy' in args:
310  proxy = True
311  args.remove('--dbproxy')
312  if '--dbproxyhost' in args:
313  proxy_host = args.pop(args.index('--dbproxyhost')+1)
314  args.remove('--dbproxyhost')
315  if '--dbproxyport' in args:
316  proxy_port = args.pop(args.index('--dbproxyport')+1)
317  args.remove('--dbproxyport')
318 
319  tunnel = False
320  tunnel_port = "10121"
321  if '--dbtunnel' in args:
322  tunnel = True
323  args.remove('--dbtunnel')
324 
325  if '--dbtunnelport' in args:
326  tunnel_port = args.pop(args.index('--dbtunnelport')+1)
327  args.remove('--dbtunnelport')
328 
329  if tunnel and proxy:
330  sys.stderr.write( 'ERROR: conflicting connection specifications, "--dbtunnel" and "--dbproxy" are mutually exclusive options\n' )
331  sys.exit(1)
332 
333  _dbs = {}
334  _dbs['v1'] = [ '--%s' % _db for _db in OfflineConverter.databases['v1'] ] + [ '--runNumber' ]
335  _dbs['v2'] = [ '--%s' % _db for _db in OfflineConverter.databases['v2'] ] + [ '--runNumber' ]
336  _dbs['v3'] = [ '--%s' % _db for _db in OfflineConverter.databases['v3'] ] + [ '--runNumber']
337  _dbs['v3-beta'] = [ '--%s' % _db for _db in OfflineConverter.databases['v3-beta'] ] + [ '--runNumber' ]
338  _dbs['v3-test'] = [ '--%s' % _db for _db in OfflineConverter.databases['v3-test'] ] + [ '--runNumber' ]
339  _dbargs = set(args) & set(sum(_dbs.values(), []))
340 
341  if _dbargs:
342  if len(_dbargs) > 1:
343  sys.stderr.write( "ERROR: too many database specifications: \"" + "\", \"".join( _dbargs) + "\"\n" )
344  sys.exit(1)
345 
346  _arg = _dbargs.pop()
347  db = _arg[2:]
348  if db == 'runNumber':
349  db = 'adg'
350  else:
351  args.remove(_arg)
352 
353  if not db in OfflineConverter.databases[version]:
354  sys.stderr.write( "ERROR: database version \"%s\" incompatible with specification \"%s\"\n" % (version, db) )
355  sys.exit(1)
356 
357  converter = OfflineConverter(version = version, database = db, verbose = verbose,
358  proxy = proxy, proxyHost = proxy_host, proxyPort = proxy_port,
359  tunnel = tunnel, tunnelPort = tunnel_port)
360  out, err = converter.query( * args )
361  if 'ERROR' in err:
362  sys.stderr.write( "%s: error while retrieving the HLT menu\n\n%s\n\n" % (sys.argv[0], err) )
363  sys.exit(1)
364  else:
365  sys.stdout.write( out )
366 
367 
std::function< unsigned int(align::ID)> Counter
static std::string join(char **cmd)
Definition: RemoteFile.cc:21