CMS 3D CMS Logo

Classes | Functions
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)
 

Function Documentation

◆ checkConfiguration()

def o2olib.checkConfiguration (   config_string)

Definition at line 420 of file o2olib.py.

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 

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

◆ print_table()

def o2olib.print_table (   headers,
  table 
)

Definition at line 58 of file o2olib.py.

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 

References print().

Referenced by o2olib.O2OJobMgr.listJobs().

◆ readConfiguration()

def o2olib.readConfiguration (   config_filename)

Definition at line 404 of file o2olib.py.

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 

References digitizers_cfi.strip.

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

o2olib.print_table
def print_table(headers, table)
Definition: o2olib.py:58
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
o2olib.readConfiguration
def readConfiguration(config_filename)
Definition: o2olib.py:404
print
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:46
o2olib.checkConfiguration
def checkConfiguration(config_string)
Definition: o2olib.py:420