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

Public Member Functions

def __init__ (self)
 
def getFolder (self, dbstring, folder, force=False)
 
def openDB (self, dbstring, oracle=False, debug=False, force=False)
 
def closeDB (self, dbstring)
 
def closeAllDB (self)
 
def closeAll (self)
 

Public Attributes

 verbose
 

Static Public Attributes

 dbDict = dict()
 

Detailed Description

Definition at line 28 of file LumiDBHandler.py.

Constructor & Destructor Documentation

◆ __init__()

def python.LumiDBHandler.LumiDBHandler.__init__ (   self)

Definition at line 38 of file LumiDBHandler.py.

38  def __init__(self):
39 
40  # Debug output (can be changed for each instance, slick...)
41  self.verbose = False
42 

Member Function Documentation

◆ closeAll()

def python.LumiDBHandler.LumiDBHandler.closeAll (   self)

Definition at line 112 of file LumiDBHandler.py.

112  def closeAll(self):
113 
114  if self.verbose:
115  print('LumiDBHandler.closeAllDB called')
116 
117  # Can't use iterkeys here as we are deleting the elements
118  for dbstring in list(self.__class__.dbDict.keys()):
119  self.closeDB(dbstring)
120 

◆ closeAllDB()

def python.LumiDBHandler.LumiDBHandler.closeAllDB (   self)

Definition at line 109 of file LumiDBHandler.py.

109  def closeAllDB(self):
110  self.closeAll()
111 

◆ closeDB()

def python.LumiDBHandler.LumiDBHandler.closeDB (   self,
  dbstring 
)

Definition at line 94 of file LumiDBHandler.py.

94  def closeDB(self, dbstring):
95 
96  if self.verbose:
97  print('LumiDBHandler.closeDB - Closing connection to', dbstring)
98 
99  if dbstring not in self.__class__.dbDict:
100  print("LumiDBHandler.closeDB - DB doesn't exist:", dbstring)
101  else:
102  try:
103  self.__class__.dbDict[dbstring].closeDatabase()
104  except Exception as e:
105  print(e)
106  self.__class__.dbDict.pop(dbstring)
107 

◆ getFolder()

def python.LumiDBHandler.LumiDBHandler.getFolder (   self,
  dbstring,
  folder,
  force = False 
)

Definition at line 46 of file LumiDBHandler.py.

46  def getFolder(self, dbstring, folder, force=False):
47 
48  if self.verbose:
49  print('LumiDBHandler.getFolder(', dbstring, ',', folder, ') called')
50 
51  if not self.openDB(dbstring, force=force):
52  print("LumiDBHandler.getFolder - can't connect to DB!")
53  return None
54 
55  return self.__class__.dbDict[dbstring].getFolder(folder)
56 

◆ openDB()

def python.LumiDBHandler.LumiDBHandler.openDB (   self,
  dbstring,
  oracle = False,
  debug = False,
  force = False 
)

Definition at line 59 of file LumiDBHandler.py.

59  def openDB(self, dbstring, oracle=False, debug=False, force=False):
60 
61  if self.verbose:
62  print('LumiDBHandler.openDB(', dbstring, ') called')
63 
64  # Check if already open
65  if dbstring in self.__class__.dbDict:
66 
67  # No force, just return
68  if not force:
69  if self.verbose:
70  print('LumiDBHandler.openDB - Connection already exists')
71  return True # Yes it is
72 
73  # Force specified, close so we can re-open
74  if self.verbose:
75  print('LumiDBHandler.openDB - Connection already exists, closing first due to force=True')
76  self.closeDB(dbstring)
77 
78  # Try to open DB connection
79  if self.verbose:
80  print(('LumiDBHandler.openDB - Connecting to', dbstring))
81 
82  try:
83  db = indirectOpen(dbstring, readOnly=True, debug=debug)
84  except Exception as e:
85  print(e)
86  return False
87 
88  # OK, opened. Save this to our dict for later use
89  self.__class__.dbDict[dbstring] = db
90 
91  return True
92 

Member Data Documentation

◆ dbDict

python.LumiDBHandler.LumiDBHandler.dbDict = dict()
static

Definition at line 35 of file LumiDBHandler.py.

◆ verbose

python.LumiDBHandler.LumiDBHandler.verbose

Definition at line 41 of file LumiDBHandler.py.


The documentation for this class was generated from the following file:
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
python.AtlCoolLib.indirectOpen
def indirectOpen(coolstr, readOnly=True, debug=False)
Definition: AtlCoolLib.py:129