CMS 3D CMS Logo

Classes | Functions | Variables
o2olib Namespace Reference

Classes

class  O2OJob
 
class  O2OJobConf
 
class  O2OJobMgr
 
class  O2ORun
 
class  O2ORunMgr
 
class  O2OTool
 

Functions

def checkConfiguration (config_string)
 
def print_table (headers, table)
 
def readConfiguration (config_filename)
 

Variables

string __author__ = 'Giacomo Govi'
 
 _Base = sqlalchemy.ext.declarative.declarative_base()
 
string coral_tpl = 'oracle://%s/%s'
 
string dev_db_service = 'cms_orcoff_prep'
 
string logFolderEnvVar = 'O2O_LOG_FOLDER'
 
 logger = logging.getLogger(__name__)
 
string messageLevelEnvVar = 'O2O_LOG_LEVEL'
 
string private_db = 'sqlite:///o2o_jobs.db'
 
string prod_db_service = 'cms_orcon_prod'
 
string schema_name = 'CMS_CONDITIONS'
 
string sqlalchemy_tpl = 'oracle://%s:%s@%s'
 
int startStatus = -1
 

Function Documentation

◆ checkConfiguration()

def o2olib.checkConfiguration (   config_string)

Definition at line 420 of file o2olib.py.

Referenced by o2olib.O2OTool.create(), and o2olib.O2OTool.setConfig().

420 def checkConfiguration( config_string ):
421  config = config_string
422  try:
423  json.loads(config)
424  except ValueError as e:
425  config = ''
426  logging.error( 'The string "%s" is an invalid json format.', config_string )
427  return config
428 
429 
def checkConfiguration(config_string)
Definition: o2olib.py:420

◆ print_table()

def o2olib.print_table (   headers,
  table 
)

Definition at line 58 of file o2olib.py.

References print().

Referenced by o2olib.O2OJobMgr.listJobs().

58 def print_table( headers, table ):
59  ws = []
60  for h in headers:
61  ws.append(len(h))
62  for row in table:
63  ind = 0
64  for c in row:
65  if ind<len(ws):
66  if len(c)> ws[ind]:
67  ws[ind] = len(c)
68  ind += 1
69 
70  def printf( row ):
71  line = ''
72  ind = 0
73  for w in ws:
74  fmt = '{:<%s}' %w
75  if ind<len(ws):
76  line += (fmt.format( row[ind] )+' ')
77  ind += 1
78  print(line)
79  printf( headers )
80  hsep = ''
81  for w in ws:
82  fmt = '{:-<%s}' %w
83  hsep += (fmt.format('')+' ')
84  print(hsep)
85  for row in table:
86  printf( row )
87 
88 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
def print_table(headers, table)
Definition: o2olib.py:58

◆ readConfiguration()

def o2olib.readConfiguration (   config_filename)

Definition at line 404 of file o2olib.py.

References nano_mu_digi_cff.strip.

Referenced by o2olib.O2OTool.create(), and o2olib.O2OTool.setConfig().

404 def readConfiguration( config_filename ):
405  config = ''
406  try:
407  with open( config_filename, 'r' ) as config_file:
408  config = config_file.read().strip('\n')
409  if config == '':
410  logging.error( 'The file %s contains an empty string.', config_filename )
411  else:
412  json.loads(config)
413  except IOError as e:
414  logging.error( 'The file %s cannot be open.', config_filename )
415  except ValueError as e:
416  config = ''
417  logging.error( 'The file "%s" contains an invalid json string.', config_filename )
418  return config
419 
def readConfiguration(config_filename)
Definition: o2olib.py:404

Variable Documentation

◆ __author__

string o2olib.__author__ = 'Giacomo Govi'
private

Definition at line 2 of file o2olib.py.

◆ _Base

o2olib._Base = sqlalchemy.ext.declarative.declarative_base()
private

Definition at line 27 of file o2olib.py.

◆ coral_tpl

string o2olib.coral_tpl = 'oracle://%s/%s'

Definition at line 20 of file o2olib.py.

◆ dev_db_service

string o2olib.dev_db_service = 'cms_orcoff_prep'

Definition at line 17 of file o2olib.py.

◆ logFolderEnvVar

string o2olib.logFolderEnvVar = 'O2O_LOG_FOLDER'

Definition at line 24 of file o2olib.py.

◆ logger

o2olib.logger = logging.getLogger(__name__)

Definition at line 25 of file o2olib.py.

◆ messageLevelEnvVar

string o2olib.messageLevelEnvVar = 'O2O_LOG_LEVEL'

Definition at line 23 of file o2olib.py.

◆ private_db

string o2olib.private_db = 'sqlite:///o2o_jobs.db'

Definition at line 21 of file o2olib.py.

◆ prod_db_service

string o2olib.prod_db_service = 'cms_orcon_prod'

Definition at line 16 of file o2olib.py.

◆ schema_name

string o2olib.schema_name = 'CMS_CONDITIONS'

Definition at line 18 of file o2olib.py.

◆ sqlalchemy_tpl

string o2olib.sqlalchemy_tpl = 'oracle://%s:%s@%s'

Definition at line 19 of file o2olib.py.

◆ startStatus

int o2olib.startStatus = -1

Definition at line 22 of file o2olib.py.