test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Functions | Variables
conddblib Namespace Reference

Classes

class  Connection
 
class  Enum
 
class  EnumMetaclass
 
class  GlobalTag
 
class  GlobalTagMap
 
class  IOV
 
class  Payload
 
class  Synchronization
 
class  Tag
 
class  TimeType
 

Functions

def _getCMSFrontierConnectionString
 
def _getCMSFrontierSQLAlchemyConnectionString
 
def _getCMSOracleSQLAlchemyConnectionString
 
def connect
 
def hash
 

Variables

string __author__ = 'Miguel Ojeda'
 
string __copyright__ = 'Copyright 2013, CERN'
 
list __credits__ = ['Giacomo Govi', 'Miguel Ojeda', 'Andreas Pfeiffer']
 
string __email__ = 'mojedasa@cern.ch'
 
string __license__ = 'Unknown'
 
string __maintainer__ = 'Miguel Ojeda'
 
tuple _Base = sqlalchemy.ext.declarative.declarative_base()
 
string contact_help = 'If you need assistance, please write an email to %s and %s. If you need immediate/urgent assistance, you can call the Offline DB expert on call (%s).'
 
string database_help
 
int description_length = 4000
 
string empty_label = '-'
 
tuple hash_length = len(hash(''))
 
tuple logger = logging.getLogger(__name__)
 
int name_length = 100
 
string offline_db_experts_email = 'cms-offlinedb-exp@cern.ch'
 
string offline_db_experts_phone = '+41 22 76 70817, or 70817 from CERN; check https://twiki.cern.ch/twiki/bin/viewauth/CMS/DBShifterHelpPage if it does not work; availability depends on the state of the LHC'
 
string web_experts_email = 'cms-cond-dev@cern.ch'
 

Detailed Description

CMS Conditions DB Python library.

Function Documentation

def conddblib._getCMSFrontierConnectionString (   database)
private

Definition at line 332 of file conddblib.py.

References communicate().

Referenced by _getCMSFrontierSQLAlchemyConnectionString().

333 def _getCMSFrontierConnectionString(database):
334  import subprocess
335  return subprocess.Popen(['cmsGetFnConnect', 'frontier://%s' % database], stdout = subprocess.PIPE).communicate()[0].strip()
336 
static void * communicate(void *obj)
Definition: DQMNet.cc:1246
def _getCMSFrontierConnectionString
Definition: conddblib.py:332
def conddblib._getCMSFrontierSQLAlchemyConnectionString (   database,
  schema = 'cms_conditions' 
)
private

Definition at line 337 of file conddblib.py.

References _getCMSFrontierConnectionString().

Referenced by connect().

338 def _getCMSFrontierSQLAlchemyConnectionString(database, schema = 'cms_conditions'):
339  import urllib
340  return 'oracle+frontier://@%s/%s' % (urllib.quote_plus(_getCMSFrontierConnectionString(database)), schema)
341 
def _getCMSFrontierConnectionString
Definition: conddblib.py:332
def _getCMSFrontierSQLAlchemyConnectionString
Definition: conddblib.py:337
def conddblib._getCMSOracleSQLAlchemyConnectionString (   database,
  schema = 'cms_conditions' 
)
private

Definition at line 342 of file conddblib.py.

Referenced by connect().

343 def _getCMSOracleSQLAlchemyConnectionString(database, schema = 'cms_conditions'):
344  return 'oracle://%s@%s' % (schema, database)
345 
346 
# Entry point
def _getCMSOracleSQLAlchemyConnectionString
Definition: conddblib.py:342
def conddblib.connect (   database = 'pro',
  init = False,
  verbose = 0 
)
Returns a Connection instance to the CMS Condition DB.

See database_help for the description of the database parameter.

The verbosity level is as follows:

    0 = No output (default).
    1 = SQL statements issued, including their parameters.
    2 = In addition, results of the queries (all rows and the column headers).

Definition at line 347 of file conddblib.py.

References _getCMSFrontierSQLAlchemyConnectionString(), and _getCMSOracleSQLAlchemyConnectionString().

348 def connect(database='pro', init=False, verbose=0):
349  '''Returns a Connection instance to the CMS Condition DB.
350 
351  See database_help for the description of the database parameter.
352 
353  The verbosity level is as follows:
354 
355  0 = No output (default).
356  1 = SQL statements issued, including their parameters.
357  2 = In addition, results of the queries (all rows and the column headers).
358  '''
359 
360  # Lazy in order to avoid calls to cmsGetFnConnect
361  mapping = {
362  'pro': lambda: _getCMSFrontierSQLAlchemyConnectionString('PromptProd'),
363  'arc': lambda: _getCMSFrontierSQLAlchemyConnectionString('FrontierArc'),
364  'int': lambda: _getCMSFrontierSQLAlchemyConnectionString('FrontierInt'),
365  'dev': lambda: _getCMSFrontierSQLAlchemyConnectionString('FrontierPrep'),
366  'boost': lambda: _getCMSFrontierSQLAlchemyConnectionString('FrontierPrep', 'cms_test_conditions'),
367 
368  'orapro': lambda: _getCMSOracleSQLAlchemyConnectionString('cms_orcon_adg'),
369  'oraarc': lambda: _getCMSOracleSQLAlchemyConnectionString('cmsarc_lb'),
370  'oraint': lambda: _getCMSOracleSQLAlchemyConnectionString('cms_orcoff_int'),
371  'oradev': lambda: _getCMSOracleSQLAlchemyConnectionString('cms_orcoff_prep'),
372  'oraboost': lambda: _getCMSOracleSQLAlchemyConnectionString('cms_orcoff_prep', 'cms_test_conditions'),
373 
374  'onlineorapro': lambda: _getCMSOracleSQLAlchemyConnectionString('cms_orcon_prod'),
375  'onlineoraint': lambda: _getCMSOracleSQLAlchemyConnectionString('cmsintr_lb'),
376  }
377 
378  if database in mapping:
379  database = mapping[database]()
380 
381  try:
382  url = sqlalchemy.engine.url.make_url(database)
383  if url.drivername == 'oracle' and url.password is None:
384  import getpass
385  url.password = getpass.getpass('Password for %s: ' % str(url))
386  except sqlalchemy.exc.ArgumentError:
387  url = sqlalchemy.engine.url.make_url('sqlite:///%s' % database)
388 
389  if verbose >= 1:
390  logging.getLogger('sqlalchemy.engine').setLevel(logging.INFO)
391 
392  if verbose >= 2:
393  logging.getLogger('sqlalchemy.engine').setLevel(logging.DEBUG)
394 
395  return Connection(url, init=init)
396 
def _getCMSOracleSQLAlchemyConnectionString
Definition: conddblib.py:342
def connect
Definition: conddblib.py:347
def _getCMSFrontierSQLAlchemyConnectionString
Definition: conddblib.py:337
def conddblib.hash (   data)

Definition at line 63 of file conddblib.py.

63 
64 def hash(data):
65  return hashlib.sha1(data).hexdigest()
66 
67 
# Constants
def hash
Definition: conddblib.py:63

Variable Documentation

string conddblib.__author__ = 'Miguel Ojeda'

Definition at line 4 of file conddblib.py.

string conddblib.__copyright__ = 'Copyright 2013, CERN'

Definition at line 5 of file conddblib.py.

list conddblib.__credits__ = ['Giacomo Govi', 'Miguel Ojeda', 'Andreas Pfeiffer']

Definition at line 6 of file conddblib.py.

string conddblib.__email__ = 'mojedasa@cern.ch'

Definition at line 9 of file conddblib.py.

string conddblib.__license__ = 'Unknown'

Definition at line 7 of file conddblib.py.

string conddblib.__maintainer__ = 'Miguel Ojeda'

Definition at line 8 of file conddblib.py.

tuple conddblib._Base = sqlalchemy.ext.declarative.declarative_base()

Definition at line 166 of file conddblib.py.

string conddblib.contact_help = 'If you need assistance, please write an email to %s and %s. If you need immediate/urgent assistance, you can call the Offline DB expert on call (%s).'

Definition at line 78 of file conddblib.py.

string conddblib.database_help

Definition at line 79 of file conddblib.py.

int conddblib.description_length = 4000

Definition at line 71 of file conddblib.py.

string conddblib.empty_label = '-'

Definition at line 68 of file conddblib.py.

tuple conddblib.hash_length = len(hash(''))

Definition at line 72 of file conddblib.py.

tuple conddblib.logger = logging.getLogger(__name__)

Definition at line 20 of file conddblib.py.

Referenced by cscdqm::Configuration.printStats().

int conddblib.name_length = 100

Definition at line 70 of file conddblib.py.

string conddblib.offline_db_experts_email = 'cms-offlinedb-exp@cern.ch'

Definition at line 75 of file conddblib.py.

string conddblib.offline_db_experts_phone = '+41 22 76 70817, or 70817 from CERN; check https://twiki.cern.ch/twiki/bin/viewauth/CMS/DBShifterHelpPage if it does not work; availability depends on the state of the LHC'

Definition at line 76 of file conddblib.py.

string conddblib.web_experts_email = 'cms-cond-dev@cern.ch'

Definition at line 74 of file conddblib.py.