CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Functions
confdbOfflineConverter Namespace Reference

Classes

class  OfflineConverter
 

Functions

def help
 
def main
 

Function Documentation

def confdbOfflineConverter.help ( )

Definition at line 180 of file confdbOfflineConverter.py.

Referenced by main().

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

Definition at line 230 of file confdbOfflineConverter.py.

References help(), and join().

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