CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
o2olib.O2OMgr Class Reference
Inheritance diagram for o2olib.O2OMgr:
o2olib.O2OJobMgr

Public Member Functions

def __init__ (self)
 
def getSession (self, db_service, auth)
 
def logger (self)
 

Public Attributes

 eng
 
 logger
 

Detailed Description

Definition at line 98 of file o2olib.py.

Constructor & Destructor Documentation

◆ __init__()

def o2olib.O2OMgr.__init__ (   self)

Reimplemented in o2olib.O2OJobMgr.

Definition at line 99 of file o2olib.py.

99  def __init__(self):
100  self.logger = logging.getLogger()
101  self.logger.setLevel(logLevel)
102  consoleHandler = logging.StreamHandler(sys.stdout)
103  consoleHandler.setFormatter(logFormatter)
104  self.logger.addHandler(consoleHandler)
105  self.eng = None
106 

Member Function Documentation

◆ getSession()

def o2olib.O2OMgr.getSession (   self,
  db_service,
  auth 
)

Definition at line 110 of file o2olib.py.

110  def getSession( self, db_service, auth ):
111  url = None
112  if db_service is None:
113  url = private_db
114  else:
115  self.logger.info('Getting credentials')
116  if auth is not None:
117  if not os.path.exists(auth):
118  self.logger.error('Authentication path %s is invalid.' %auth)
119  return None
120  try:
121  username, pwd = get_db_credentials( db_service, auth )
122  except Exception as e:
123  logging.debug(str(e))
124  username = None
125  pwd = None
126  if username is None:
127  logging.error('Credentials for service %s (machine=%s) are not available' %(db_service[0],db_service[1]))
128  raise Exception("Cannot connect to db %s" %db_service[0] )
129  url = sqlalchemy_tpl %(username,pwd,db_service[0])
130  session = None
131  try:
132  self.eng = sqlalchemy.create_engine( url )
133  session = sqlalchemy.orm.scoped_session( sqlalchemy.orm.sessionmaker(bind=self.eng))
134  except sqlalchemy.exc.SQLAlchemyError as dberror:
135  self.logger.error( str(dberror) )
136  return session
137 

References o2olib.O2OMgr.eng, relativeConstraints.error, o2olib.get_db_credentials(), info(), crabFunctions.CrabController.logger, o2olib.O2OMgr.logger, and str.

◆ logger()

def o2olib.O2OMgr.logger (   self)

Definition at line 107 of file o2olib.py.

107  def logger( self ):
108  return self.logger
109 

References crabFunctions.CrabController.logger, and o2olib.O2OMgr.logger.

Member Data Documentation

◆ eng

o2olib.O2OMgr.eng

Definition at line 105 of file o2olib.py.

Referenced by o2olib.O2OMgr.getSession().

◆ logger

o2olib.O2OMgr.logger
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:152
relativeConstraints.error
error
Definition: relativeConstraints.py:53
fwlog::logger
std::ostream & logger()
Definition: fwLog.cc:36
o2olib.get_db_credentials
def get_db_credentials(db_service, authPath)
Definition: o2olib.py:64
str
#define str(s)
Definition: TestProcessor.cc:48
Exception