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

Referenced by main().

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

◆ main()

def confdbOfflineConverter.main ( )

Definition at line 230 of file confdbOfflineConverter.py.

References help(), and join().

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