Skip to content
Snippets Groups Projects
Commit 4ba27d22 authored by Duc Ta's avatar Duc Ta
Browse files

Merge branch 'fwinkl_20240306T123800' into '24.0'

IOVDbSvc.CondDB: remove usage of RecFlags

See merge request !69565
parents 7f1a3348 db349cd7
No related branches found
No related tags found
2 merge requests!696182024-03-07: merge of 24.0 into main,!69565IOVDbSvc.CondDB: remove usage of RecFlags
# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
# CondDB.py
# Configuration for Athena conditions DB access
......@@ -93,9 +93,14 @@ class CondDB:
else:
# real data
if (self.dbdata=='auto'):
from RecExConfig.RecFlags import rec
self.dbdata=self._InstanceFromProjectName(rec.projectName())
self.msg.info("Configuring database instance %s based on project tag %s", self.dbdata, rec.projectName())
project_name = ''
if athenaCommonFlags.FilesInput():
from PyUtils.MetaReader import read_metadata
metadata = read_metadata(athenaCommonFlags.FilesInput())
project_name = metadata[athenaCommonFlags.FilesInput()[0]]['project_name']
self.dbdata=self._InstanceFromProjectName(project_name)
self.msg.info("Configuring database instance '%s' based on project tag '%s'", self.dbdata, project_name)
self.dbname=self.dbdata
self.poolcats=['comcond','oflcond']
elif (globalflags.DetGeo() in ['ctbh8','ctbh6']):
......@@ -413,12 +418,12 @@ This allows the possibility of later adding a new IOV using IOVSvc::setRange."""
else:
return self.dbname
#decide database instance based on project tag dataXX_
#decide database instance based on project tag dataXX_
def _InstanceFromProjectName(self,projectName):
try:
year=int(projectName[4:6])
except Exception:
self.msg.warning("Failed to extract year from project tag "+ projectName+". Guessing run2")
self.msg.warning(f"Failed to extract year from project tag '{projectName}', using CONDBR2.")
return "CONDBR2"
if (year>13):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment