CMS 3D CMS Logo

Classes | Functions
confdbOfflineConverter Namespace Reference

Classes

class  OfflineConverter
 

Functions

def help ()
 
def main ()
 

Function Documentation

def confdbOfflineConverter.help ( )

Definition at line 131 of file confdbOfflineConverter.py.

Referenced by main().

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

Definition at line 181 of file confdbOfflineConverter.py.

References help(), and join().

181 def main():
182  args = sys.argv[1:]
183  version = 'v2'
184  db = 'offline'
185  verbose = False
186 
187  if not args:
188  help()
189  sys.exit(1)
190 
191  if '--help' in args or '-h' in args:
192  help()
193  sys.exit(0)
194 
195  if '--verbose' in args:
196  verbose = True
197  args.remove('--verbose')
198 
199  if '--v1' in args and '--v2' in args:
200  sys.stderr.write( "ERROR: conflicting database version specifications \"--v1\" and \"--v2\"\n" )
201  sys.exit(1)
202 
203  if '--v1' in args:
204  version = 'v1'
205  db = 'offline'
206  args.remove('--v1')
207 
208  if '--v2' in args:
209  version = 'v2'
210  db = 'offline'
211  args.remove('--v2')
212 
213  _dbs = {}
214  _dbs['v1'] = [ '--%s' % _db for _db in OfflineConverter.databases['v1'] ] + [ '--runNumber' ]
215  _dbs['v2'] = [ '--%s' % _db for _db in OfflineConverter.databases['v2'] ] + [ '--runNumber' ]
216  _dbargs = set(args) & set(sum(_dbs.values(), []))
217 
218  if _dbargs:
219  if len(_dbargs) > 1:
220  sys.stderr.write( "ERROR: too many database specifications: \"" + "\", \"".join( _dbargs) + "\"\n" )
221  sys.exit(1)
222 
223  _arg = _dbargs.pop()
224  db = _arg[2:]
225  if db == 'runNumber':
226  db = 'adg'
227  else:
228  args.remove(_arg)
229 
230  if not db in OfflineConverter.databases[version]:
231  sys.stderr.write( "ERROR: database version \"%s\" incompatible with specification \"%s\"\n" % (version, db) )
232  sys.exit(1)
233 
234  converter = OfflineConverter(version = version, database = db, verbose = verbose)
235  out, err = converter.query( * args )
236  if 'ERROR' in err:
237  sys.stderr.write( "%s: error while retriving the HLT menu\n\n%s\n\n" % (sys.argv[0], err) )
238  sys.exit(1)
239  else:
240  sys.stdout.write( out )
241 
242 
static std::string join(char **cmd)
Definition: RemoteFile.cc:18