ATLAS Offline Software
Public Member Functions | Public Attributes | Private Member Functions | List of all members
python.AtlCoolLib.coolTool Class Reference
Collaboration diagram for python.AtlCoolLib.coolTool:

Public Member Functions

def __init__ (self, name, readonly, minarg, maxarg, longopts)
 
def procopts (self, opts)
 

Public Attributes

 name
 
 readonly
 
 runLumi
 
 runmin
 
 runmax
 
 lumimin
 
 lumimax
 
 tsmin
 
 tsmax
 
 since
 
 until
 
 debug
 
 conn
 
 db
 

Private Member Functions

def _usage1 (self)
 
def _usage2 (self)
 
def _procopts (self, opts)
 

Detailed Description

Class coolTool implements a base for python command-line tools to access
and set data in COOL folders
Incomplete baseclass implementation - clients must implement the following:
 - setup(self,args) - set additional arguments
 - usage(self) - print usage
 - execute(self) - execute command
 - procopts(self,opts) - (optional) - process additional command switches

Definition at line 287 of file AtlCoolLib.py.

Constructor & Destructor Documentation

◆ __init__()

def python.AtlCoolLib.coolTool.__init__ (   self,
  name,
  readonly,
  minarg,
  maxarg,
  longopts 
)
Initialise class and process command line options and switches

Definition at line 297 of file AtlCoolLib.py.

297  def __init__(self,name,readonly,minarg,maxarg,longopts):
298  """
299  Initialise class and process command line options and switches
300  """
301  self.name=name
302  self.readonly=readonly
303  self.runLumi=True
304  self.runmin=0
305  self.runmax=(1 << 31)-1
306  self.lumimin=0
307  self.lumimax=(1 << 32)-2
308  self.tsmin=cool.ValidityKeyMin
309  self.tsmax=cool.ValidityKeyMax
310  self.since=cool.ValidityKeyMin
311  self.until=cool.ValidityKeyMax
312  self.debug=False
313  # get and process options - note only use long options format
314  try:
315  fullopts=longopts+['r=','rs=','ru=','l=','ls=','lu=','ts=','tu=','debug']
316  opts,args=getopt.getopt(sys.argv[1:],'',fullopts)
317  except getopt.GetoptError as e:
318  print (e)
319  self.usage()
320  sys.exit(1)
321  if len(args)<minarg or len(args)>maxarg:
322  print (name,'takes between',minarg,'and',maxarg,'non-optional parameters')
323  self.usage()
324  sys.exit(1)
325  # set standard parameters
326  self.conn=transConn(str(args[0]))
327  # allow derived class to set parameters
328  self.setup(args[1:])
329  self._procopts(opts)
330  self.procopts(opts)
331  # open database connection and execute command
332  if self.readonly:
333  self.db=indirectOpen(self.conn,debug=self.debug)
334  else:
335  self.db=forceOpen(self.conn)
336  self.execute()
337 

Member Function Documentation

◆ _procopts()

def python.AtlCoolLib.coolTool._procopts (   self,
  opts 
)
private

Definition at line 355 of file AtlCoolLib.py.

355  def _procopts(self,opts):
356  # process the standard parameters
357  for o,a in opts:
358  if (o=='--rs'): self.runmin=int(a)
359  if (o=='--ru'): self.runmax=int(a)
360  if (o=='--r'):
361  self.runmin=int(a)
362  self.runmax=int(a)
363  if (o=='--ls'): self.lumimin=int(a)
364  if (o=='--lu'): self.lumimax=int(a)
365  if (o=='--l'):
366  self.lumimin=int(a)
367  self.lumimax=int(a)
368  if (o=='--ts'):
369  self.tsmin=timeVal(a)*1000000000
370  self.runLumi=False
371  if (o=='--tu'):
372  self.tsmax=timeVal(a)*1000000000
373  self.runLumi=False
374  if (o=='--debug'): self.debug=True
375  # now set the real interval of validity
376  if (self.runLumi):
377  print ('>== Data valid for run,LB [',self.runmin,',',self.lumimin,'] to [',self.runmax,',',self.lumimax,']')
378  self.since=(self.runmin << 32)+self.lumimin
379  self.until=(self.runmax << 32)+self.lumimax+1
380  else:
381  self.since=self.tsmin
382  self.until=self.tsmax
383  print ('>== Data valid for timestamps (sec) from ',self.since/1000000000,'(',timeString(self.since),') to ',self.until/1000000000,'(',timeString(self.until),')')
384  # check IOV is OK
385  if (self.until<self.since):
386  print ('ERROR in IOV definition: until<since')
387  sys.exit(1)
388 

◆ _usage1()

def python.AtlCoolLib.coolTool._usage1 (   self)
private

Definition at line 338 of file AtlCoolLib.py.

338  def _usage1(self):
339  # base implementation of usage - first part
340  print ('Usage:',self.name,' {<options>} dbname ',)
341 

◆ _usage2()

def python.AtlCoolLib.coolTool._usage2 (   self)
private

Definition at line 342 of file AtlCoolLib.py.

342  def _usage2(self):
343  # base implementation of usage - second part
344  print ('Options to specify IOV (default valid for all intervals)')
345  print ('--rs=<first run>')
346  print ('--ru=<last run> (inclusive)')
347  print ('--r=<run> (only single run)')
348  print ('--ls=<lumi block since>')
349  print ('--l=<lumi block> (only single LB)')
350  print ('--lu=<lumi block until> (inclusive)')
351  print ('--ts=<initial timestamp> (in seconds)')
352  print ('--tu=<final timestamp> (in seconds)')
353  print ('--debug: Enable debugging information')
354 

◆ procopts()

def python.AtlCoolLib.coolTool.procopts (   self,
  opts 
)

Definition at line 389 of file AtlCoolLib.py.

389  def procopts(self,opts):
390  # default implementation of procopts - do nothing
391  pass
392 
393 

Member Data Documentation

◆ conn

python.AtlCoolLib.coolTool.conn

Definition at line 326 of file AtlCoolLib.py.

◆ db

python.AtlCoolLib.coolTool.db

Definition at line 333 of file AtlCoolLib.py.

◆ debug

python.AtlCoolLib.coolTool.debug

Definition at line 312 of file AtlCoolLib.py.

◆ lumimax

python.AtlCoolLib.coolTool.lumimax

Definition at line 307 of file AtlCoolLib.py.

◆ lumimin

python.AtlCoolLib.coolTool.lumimin

Definition at line 306 of file AtlCoolLib.py.

◆ name

python.AtlCoolLib.coolTool.name

Definition at line 301 of file AtlCoolLib.py.

◆ readonly

python.AtlCoolLib.coolTool.readonly

Definition at line 302 of file AtlCoolLib.py.

◆ runLumi

python.AtlCoolLib.coolTool.runLumi

Definition at line 303 of file AtlCoolLib.py.

◆ runmax

python.AtlCoolLib.coolTool.runmax

Definition at line 305 of file AtlCoolLib.py.

◆ runmin

python.AtlCoolLib.coolTool.runmin

Definition at line 304 of file AtlCoolLib.py.

◆ since

python.AtlCoolLib.coolTool.since

Definition at line 310 of file AtlCoolLib.py.

◆ tsmax

python.AtlCoolLib.coolTool.tsmax

Definition at line 309 of file AtlCoolLib.py.

◆ tsmin

python.AtlCoolLib.coolTool.tsmin

Definition at line 308 of file AtlCoolLib.py.

◆ until

python.AtlCoolLib.coolTool.until

Definition at line 311 of file AtlCoolLib.py.


The documentation for this class was generated from the following file:
python.AtlCoolLib.forceOpen
def forceOpen(conn)
Definition: AtlCoolLib.py:27
transConn
std::string transConn(const std::string &inconn)
Definition: openCoraCool.cxx:323
python.processes.powheg.ZZj_MiNNLO.ZZj_MiNNLO.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZj_MiNNLO.py:18
python.AtlCoolLib.timeVal
def timeVal(val)
Definition: AtlCoolLib.py:106
python.AtlCoolLib.timeString
def timeString(iovkey)
Definition: AtlCoolLib.py:119
python.CaloAddPedShiftConfig.int
int
Definition: CaloAddPedShiftConfig.py:45
str
Definition: BTagTrackIpAccessor.cxx:11
python.AtlCoolLib.indirectOpen
def indirectOpen(coolstr, readOnly=True, debug=False)
Definition: AtlCoolLib.py:129