Skip to content

Commit

Permalink
Merge pull request cms-sw#10181 from fwyzard/76X_update_hltGetConfigu…
Browse files Browse the repository at this point in the history
…ration_for_ConfDB_v2_CMSSW

update hltGetConfiguration for ConfDB v2 (76x)
  • Loading branch information
davidlange6 committed Jul 15, 2015
2 parents 0a956f1 + a3784ce commit 9e4c208
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 28 deletions.
14 changes: 5 additions & 9 deletions HLTrigger/Configuration/python/Tools/confdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def __init__(self, configuration):

# get the configuration from ConfdB
from confdbOfflineConverter import OfflineConverter
self.converter = OfflineConverter(database = self.config.menu.db)
self.converter = OfflineConverter(version = self.config.menu.version, database = self.config.menu.database)
self.buildPathList()
self.buildOptions()
self.getRawConfigurationFromDB()
Expand All @@ -74,10 +74,8 @@ def getRawConfigurationFromDB(self):

data, err = self.converter.query( *args )
if 'ERROR' in err or 'Exhausted Resultset' in err or 'CONFIG_NOT_FOUND' in err:
print "%s: error while retriving the HLT menu" % os.path.basename(sys.argv[0])
print
print err
print
sys.stderr.write("%s: error while retrieving the HLT menu\n\n" % os.path.basename(sys.argv[0]))
sys.stderr.write(err + "\n\n")
sys.exit(1)
self.data = data

Expand All @@ -98,10 +96,8 @@ def getPathList(self):

data, err = self.converter.query( *args )
if 'ERROR' in err or 'Exhausted Resultset' in err or 'CONFIG_NOT_FOUND' in err:
print "%s: error while retriving the list of paths from the HLT menu" % os.path.basename(sys.argv[0])
print
print err
print
sys.stderr.write("%s: error while retrieving the list of paths from the HLT menu\n\n" % os.path.basename(sys.argv[0]))
sys.stderr.write(err + "\n\n")
sys.exit(1)
filter = re.compile(r' *= *cms.(End)?Path.*')
paths = [ filter.sub('', line) for line in data.splitlines() if filter.search(line) ]
Expand Down
74 changes: 55 additions & 19 deletions HLTrigger/Configuration/python/Tools/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,28 +50,64 @@ def __init__(self, value):

# type used to store a reference to an HLT configuration
class ConnectionHLTMenu(object):
valid_versions = 'v1', 'v2'
valid_databases = 'online', 'offline', 'adg'
compatibility = { 'hltdev': ('v1', 'offline'), 'orcoff': ('v2', 'adg') }

def __init__(self, value):
self.value = value
self.db = None
self.name = None
self.run = None
self.version = None
self.database = None
self.name = None
self.run = None

# extract the database and configuration name
if value:
if ':' in self.value:
(db, name) = self.value.split(':')
if db == 'run':
self.db = 'orcoff'
self.run = name
elif db in ('hltdev', 'orcoff'):
self.db = db
self.name = name
else:
raise Exception('Unknown ConfDB database "%s", valid values are "hltdev" (default) and "orcoff")' % db)
else:
self.db = 'hltdev'
self.name = self.value
if not value:
return

if not ':' in value:
# default to 'v1/offline'
self.version = 'v1'
self.database = 'offline'
self.name = value
return

# extract the version, database and configuration name
tokens = value.split(':')
if len(tokens) != 2:
raise Exception('Invalid HLT menu specification "%s"' % value)
(db, name) = tokens
# check if the menu should be automatically determined based on the run number
if db == 'run':
self.version = 'v1'
self.database = 'adg'
self.run = name
# check for backward compatibility names
elif db in self.compatibility:
self.version, self.database = self.compatibility[db]
self.name = name
else:
if '/' in db:
# extract the version and database
tokens = db.split('/')
if len(tokens) != 2:
raise Exception('Invalid HLT menu specification "%s"' % value)
(v, db) = tokens
if v not in self.valid_versions:
raise Exception('Invalid HLT database version "%s", valid values are "%s"' % (v, '", "'.join(self.valid_versions)))
if db not in self.valid_databases:
raise Exception('Invalid HLT database "%s", valid values are "%s"' % (db, '", "'.join(self.valid_databases)))
self.version = v
self.database = db
self.name = name
else:
# use the default version for the given database
if db not in self.valid_databases:
raise Exception('Invalid HLT database "%s", valid values are "%s"' % (db, '", "'.join(self.valid_databases)))
self.database = db
if db == 'offline' :
self.version = 'v1'
else:
self.version = 'v2'
self.name = name

# options marked with a (*) only apply when creating a whole process configuration
class HLTProcessOptions(object):
Expand Down

0 comments on commit 9e4c208

Please sign in to comment.