Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update hltGetConfiguration for ConfDB v2 (76x) #10181

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 5 additions & 9 deletions HLTrigger/Configuration/python/Tools/confdb.py
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
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