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

144 def help():
145  sys.stdout.write("""Usage: %s OPTIONS
146 
147  --v1|--v2|--v3|--v3-beta|--v3-test (specify the ConfDB version [default: v3])
148 
149  --run3|--run2|--dev|--online|--adg (specify the target db [default: run3], online will only work inside p5 network)
150 
151  Note that for v1
152  --orcoff is a synonim of --adg
153  --offline is a synonim of --hltdev
154 
155  --configId <id> (specify the configuration by id)
156  --configName <name> (specify the configuration by name)
157  --runNumber <run> (specify the configuration by run number)
158  [exactly one of --configId OR --configName OR --runNumber is required]
159 
160  --cff (retrieve configuration *fragment*)
161  --input <f1.root[,f2.root]> (insert PoolSource with specified fileNames)
162  --input <files.list> (read a text file which lists input ROOT files)
163  --output <out.root> (insert PoolOutputModule w/ specified fileName)
164  --nopsets (exclude all globale psets)
165  --noedsources (exclude all edsources)
166  --noes (exclude all essources *and* esmodules)
167  --noessources (exclude all essources)
168  --noesmodules (exclude all esmodules)
169  --noservices (exclude all services)
170  --nooutput (exclude all output modules)
171  --nopaths (exclude all paths [+=referenced seqs&mods])
172  --nosequences (don't define sequences [+=referenced s&m])
173  --nomodules (don't define modules)
174  --psets <pset1[,pset2]> (include only specified global psets)
175  --psets <-pset1[,-pset2]> (include all global psets but the specified)
176  --essources <ess1[,ess2]> (include only specified essources)
177  --essources <-ess1[,-ess2]> (include all essources but the specified)
178  --esmodules <esm1[,esm2]> (include only specified esmodules)
179  --esmodules <-esm1[,-esm2]> (include all esmodules but the specified)
180  --services <svc1[,svc2]> (include only specified services)
181  --services <-svc1[,-svc2]> (include all services but the specified)
182  --paths <p1[,p2]> (include only specified paths)
183  --paths <-p1[,-p2]> (include all paths but the specified)
184  --streams <s1[,s2]> (include only specified streams)
185  --datasets <d1[,d2]> (include only specified datasets)
186  --sequences <s1[,s2]> (include sequences, referenced or not!)
187  --modules <p1[,p2]> (include modules, referenced or not!)
188  --blocks <m1::p1[,p2][,m2]> (generate parameter blocks)
189 
190  --verbose (print additional details)
191 """)
192 
193 

Referenced by main().

◆ main()

def confdbOfflineConverter.main ( )

Definition at line 194 of file confdbOfflineConverter.py.

194 def main():
195  args = sys.argv[1:]
196  version = 'v3'
197  db = 'run3'
198  verbose = False
199 
200  if not args:
201  help()
202  sys.exit(1)
203 
204  if '--help' in args or '-h' in args:
205  help()
206  sys.exit(0)
207 
208  if '--verbose' in args:
209  verbose = True
210  args.remove('--verbose')
211 
212  arg_count = Counter(args)
213  db_count = arg_count['--v1'] + arg_count['--v2'] + arg_count['--v3'] + arg_count['--v3-beta'] + arg_count['--v3-test']
214  if db_count>1:
215  sys.stderr.write( 'ERROR: conflicting database version specifications: "--v1", "--v2", "--v3", "--v3-beta", and "--v3-test" are mutually exclusive options' )
216  sys.exit(1)
217 
218  if '--v1' in args:
219  version = 'v1'
220  db = 'offline'
221  args.remove('--v1')
222 
223  if '--v2' in args:
224  version = 'v2'
225  db = 'run2'
226  args.remove('--v2')
227 
228  if '--v3' in args:
229  version = 'v3'
230  db = 'run3'
231  args.remove('--v3')
232 
233  if '--v3-beta' in args:
234  version = 'v3-beta'
235  db = 'run3'
236  args.remove('--v3-beta')
237 
238  if '--v3-test' in args:
239  version = 'v3-test'
240  db = 'dev'
241  args.remove('--v3-test')
242 
243  _dbs = {}
244  _dbs['v1'] = [ '--%s' % _db for _db in OfflineConverter.databases['v1'] ] + [ '--runNumber' ]
245  _dbs['v2'] = [ '--%s' % _db for _db in OfflineConverter.databases['v2'] ] + [ '--runNumber' ]
246  _dbs['v3'] = [ '--%s' % _db for _db in OfflineConverter.databases['v3'] ] + [ '--runNumber']
247  _dbs['v3-beta'] = [ '--%s' % _db for _db in OfflineConverter.databases['v3-beta'] ] + [ '--runNumber' ]
248  _dbs['v3-test'] = [ '--%s' % _db for _db in OfflineConverter.databases['v3-test'] ] + [ '--runNumber' ]
249  _dbargs = set(args) & set(sum(_dbs.values(), []))
250 
251  if _dbargs:
252  if len(_dbargs) > 1:
253  sys.stderr.write( "ERROR: too many database specifications: \"" + "\", \"".join( _dbargs) + "\"\n" )
254  sys.exit(1)
255 
256  _arg = _dbargs.pop()
257  db = _arg[2:]
258  if db == 'runNumber':
259  db = 'adg'
260  else:
261  args.remove(_arg)
262 
263  if not db in OfflineConverter.databases[version]:
264  sys.stderr.write( "ERROR: database version \"%s\" incompatible with specification \"%s\"\n" % (version, db) )
265  sys.exit(1)
266 
267  converter = OfflineConverter(version = version, database = db, verbose = verbose)
268  out, err = converter.query( * args )
269  if 'ERROR' in err:
270  sys.stderr.write( "%s: error while retriving the HLT menu\n\n%s\n\n" % (sys.argv[0], err) )
271  sys.exit(1)
272  else:
273  sys.stdout.write( out )
274 
275 

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:194
confdbOfflineConverter.help
def help()
Definition: confdbOfflineConverter.py:144