Skip to content

Commit

Permalink
hltGetConfiguration: add support fo ConfDB v2
Browse files Browse the repository at this point in the history
  • Loading branch information
fwyzard committed Jul 14, 2015
1 parent bf74269 commit 55dd436
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 20 deletions.
2 changes: 1 addition & 1 deletion 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 Down
71 changes: 52 additions & 19 deletions HLTrigger/Configuration/python/Tools/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,28 +50,61 @@ 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': ('v1', '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.version = 'v1'
self.database = db
self.name = name

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

0 comments on commit 55dd436

Please sign in to comment.