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

Public Member Functions

def __init__ (self)
 
def GetDBConn (self, schema, db)
 
def get_auth (self, key)
 
def GetAtlasRunDBConnection (self)
 
def GetSFODBConnection (self)
 
def GetTier0DBConnection (self)
 
def GetPVSSDBConnection (self)
 
def CloseAll (self)
 

Public Attributes

 openConn
 
 pw
 

Detailed Description

Definition at line 109 of file AtlRunQueryUtils.py.

Constructor & Destructor Documentation

◆ __init__()

def python.utils.AtlRunQueryUtils.DBConnectionController.__init__ (   self)

Definition at line 110 of file AtlRunQueryUtils.py.

110  def __init__(self):
111  self.openConn = {}
112  self.pw = {}
113 

Member Function Documentation

◆ CloseAll()

def python.utils.AtlRunQueryUtils.DBConnectionController.CloseAll (   self)

Definition at line 180 of file AtlRunQueryUtils.py.

180  def CloseAll(self):
181  for (dbname,dbconn) in self.openConn.items():
182  if isinstance(dbconn,cx_Oracle.Connection):
183  dbconn.close()
184  else:
185  dbconn.closeDatabase()
186 
187 

◆ get_auth()

def python.utils.AtlRunQueryUtils.DBConnectionController.get_auth (   self,
  key 
)

Definition at line 135 of file AtlRunQueryUtils.py.

135  def get_auth(self,key):
136  if key not in self.pw:
137  from os import environ as env
138  #lookup = XMLReader(env['CORAL_DBLOOKUP_PATH']+"/dblookup.xml")
139  #for s in lookup.servicelist.logicalservices:
140  # print ("Service",s['name'])
141  # for p in s.services:
142  # print (" name",p['name'])
143  auth = XMLReader(env['CORAL_AUTH_PATH']+"/authentication.xml")
144  for c in auth.connectionlist.connections:
145  if key!=c['name']:
146  continue
147  self.pw[key] = dict([(p['name'],p['value']) for p in c.parameters])
148  break
149  if key not in self.pw:
150  print ("Can not authenticate DB",key)
151  sys.exit(0)
152  return self.pw[key]
153 
154 

◆ GetAtlasRunDBConnection()

def python.utils.AtlRunQueryUtils.DBConnectionController.GetAtlasRunDBConnection (   self)

Definition at line 155 of file AtlRunQueryUtils.py.

155  def GetAtlasRunDBConnection(self):
156  if 'run' not in self.openConn:
157  auth = self.get_auth('oracle://ATLAS_COOLPROD/ATLAS_COOLOFL_TRIGGER')
158  self.openConn['run'] = cx_Oracle.connect("%s/%s@ATLAS_COOLPROD" % (auth['user'],auth['password']))
159  return self.openConn['run']
160 

◆ GetDBConn()

def python.utils.AtlRunQueryUtils.DBConnectionController.GetDBConn (   self,
  schema,
  db 
)
for example schema=COOLONL_TRIGGER', db='CONDBR2

Definition at line 114 of file AtlRunQueryUtils.py.

114  def GetDBConn(self, schema, db):
115  """for example schema=COOLONL_TRIGGER', db='CONDBR2"""
116  if (schema,db) in self.openConn:
117  return self.openConn[(schema,db)]
118  try:
119  if schema=="DEFECTS":
120  #from AthenaCommon.Logging import logging # this is needed because of some problem in DQUtils logger
121  # the logger there, if called first makes the athena logger crash
122  defdb = DQDefects.DefectsDB("COOLOFL_GLOBAL/CONDBR2",tag=db)
123  defdb.closeDatabase = lambda: None
124  self.openConn[(schema,db)] = defdb
125  else:
126  logging=False
127  from CoolConvUtilities.AtlCoolLib import indirectOpen
128  self.openConn[(schema,db)] = indirectOpen("%s/%s"%(schema,db),True, logging)
129  except Exception:
130  import traceback
131  traceback.print_exc()
132  sys.exit(-1)
133  return self.openConn[(schema,db)]
134 

◆ GetPVSSDBConnection()

def python.utils.AtlRunQueryUtils.DBConnectionController.GetPVSSDBConnection (   self)

Definition at line 174 of file AtlRunQueryUtils.py.

174  def GetPVSSDBConnection(self):
175  if 'pvss' not in self.openConn:
176  auth = self.get_auth('oracle://ATLAS_PVSSPROD/ATLAS_PVSS_READER')
177  self.openConn['pvss'] = cx_Oracle.connect("%s/%s@ATLAS_PVSSPROD" % (auth['user'],auth['password']))
178  return self.openConn['pvss']
179 

◆ GetSFODBConnection()

def python.utils.AtlRunQueryUtils.DBConnectionController.GetSFODBConnection (   self)

Definition at line 161 of file AtlRunQueryUtils.py.

161  def GetSFODBConnection(self):
162  if 'sfo' not in self.openConn:
163  auth = self.get_auth('oracle://ATLAS_CONFIG/ATLAS_SFO_T0_R')
164  with timer("Opening Connection to ATLAS_SFO_T0_R @ ATLAS_CONFIG"):
165  self.openConn['sfo'] = cx_Oracle.connect("%s/%s@ATLAS_CONFIG" % (auth['user'],auth['password']))
166  return self.openConn['sfo']
167 

◆ GetTier0DBConnection()

def python.utils.AtlRunQueryUtils.DBConnectionController.GetTier0DBConnection (   self)

Definition at line 168 of file AtlRunQueryUtils.py.

168  def GetTier0DBConnection(self):
169  if 'tier0' not in self.openConn:
170  auth = self.get_auth('oracle://ATLAS_T0/ATLAS_T0')
171  self.openConn['tier0'] = cx_Oracle.connect("%s/%s@ATLAS_T0" % (auth['user'],auth['password']))
172  return self.openConn['tier0']
173 

Member Data Documentation

◆ openConn

python.utils.AtlRunQueryUtils.DBConnectionController.openConn

Definition at line 111 of file AtlRunQueryUtils.py.

◆ pw

python.utils.AtlRunQueryUtils.DBConnectionController.pw

Definition at line 112 of file AtlRunQueryUtils.py.


The documentation for this class was generated from the following file:
python.utils.AtlRunQueryTimer.timer
def timer(name, disabled=False)
Definition: AtlRunQueryTimer.py:86
TrigJetMonitorAlgorithm.items
items
Definition: TrigJetMonitorAlgorithm.py:79
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:130