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 29 of file LumiDBHandler.py.

Constructor & Destructor Documentation

◆ __init__()

def python.LumiDBHandler.LumiDBHandler.__init__ (   self)

Definition at line 39 of file LumiDBHandler.py.

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

Member Function Documentation

◆ closeAll()

def python.LumiDBHandler.LumiDBHandler.closeAll (   self)

Definition at line 113 of file LumiDBHandler.py.

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

◆ closeAllDB()

def python.LumiDBHandler.LumiDBHandler.closeAllDB (   self)

Definition at line 110 of file LumiDBHandler.py.

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

◆ closeDB()

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

Definition at line 95 of file LumiDBHandler.py.

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

◆ getFolder()

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

Definition at line 47 of file LumiDBHandler.py.

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

◆ openDB()

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

Definition at line 60 of file LumiDBHandler.py.

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

Member Data Documentation

◆ dbDict

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

Definition at line 36 of file LumiDBHandler.py.

◆ verbose

python.LumiDBHandler.LumiDBHandler.verbose

Definition at line 42 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
python.processes.powheg.ZZ.ZZ.__init__
def __init__(self, base_directory, **kwargs)
Constructor: all process options are set here.
Definition: ZZ.py:18
Muon::print
std::string print(const MuPatSegment &)
Definition: MuonTrackSteering.cxx:28
python.AtlCoolLib.indirectOpen
def indirectOpen(coolstr, readOnly=True, debug=False)
Definition: AtlCoolLib.py:130