|
def | __init__ (self, doOldStyleConfig=False) |
|
def | addFolder (self, ident, folder, force=False, forceMC=False, forceData=False, className=None, extensible=False) |
|
def | addFolderWithTag (self, ident, folder, tag, force=False, forceMC=False, forceData=False, className=None) |
|
def | addFolderSplitOnline (self, ident, folder1, folder2, force=False, forceMC=False, forceData=False, className=None, extensible=False) |
|
def | addFolderSplitMC (self, ident, folder1, folder2, force=False, forceMC=False, forceData=False, className=None) |
|
def | addOverride (self, folder, tag) |
|
def | blockFolder (self, folder) |
|
def | folderRequested (self, folder) |
|
def | addMarkup (self, folder, markup) |
|
def | setGlobalTag (self, tag) |
|
def | setRequireLock (self, lock=True) |
|
def | setWriteDataToFile (self, writeData=False) |
|
def | setCrestToFile (self, crestData=False) |
|
def | extractFolder (self, folderstr) |
|
def | dumpFolderTags (self, outfile, folderNames=False, folderOrigin=False) |
|
def | dumpFolderReadReal (self, outfile) |
|
def | GetInstance (self, forceMC=False, forceData=False) |
|
Definition at line 54 of file CondDB.py.
◆ __init__()
def python.CondDB.CondDB.__init__ |
( |
|
self, |
|
|
|
doOldStyleConfig = False |
|
) |
| |
Definition at line 56 of file CondDB.py.
56 def __init__(self,doOldStyleConfig=False):
57 "Setup conditions DB - IOVDbSvc and connections according to GlobalFlags"
58 from AthenaCommon.AppMgr
import ServiceMgr
as svcMgr
59 from AthenaCommon.Logging
import logging
60 self.msg = logging.getLogger(
'IOVDbSvc.CondDB' )
61 self.msg.
debug(
"Loading basic services for CondDBSetup...")
64 from AthenaPoolCnvSvc
import AthenaPool
65 from IOVDbSvc
import IOVDb
67 self.iovdbsvc=svcMgr.IOVDbSvc
81 from AthenaCommon.GlobalFlags
import globalflags
82 from AthenaCommon.AthenaCommonFlags
import athenaCommonFlags
83 self.isOnline=athenaCommonFlags.isOnline()
84 self.isMC=
not globalflags.DataSource()==
'data'
85 if (globalflags.DetGeo()
in [
'atlas',
'commis']):
88 self.dbdata=globalflags.DatabaseInstance()
92 self.poolcats=[
'oflcond']
95 if (self.dbdata==
'auto'):
97 if athenaCommonFlags.FilesInput():
98 from PyUtils.MetaReader
import read_metadata
100 project_name = metadata[athenaCommonFlags.FilesInput()[0]][
'project_name']
102 self.dbdata=self._InstanceFromProjectName(project_name)
103 self.msg.
info(
"Configuring database instance '%s' based on project tag '%s'", self.dbdata, project_name)
104 self.dbname=self.dbdata
105 self.poolcats=[
'comcond',
'oflcond']
106 elif (globalflags.DetGeo()
in [
'ctbh8',
'ctbh6']):
108 self.dbdata=
'TBDP200'
111 self.dbname=self.dbmc
112 self.poolcats=[
'tbcond',
'oflcond']
115 self.dbname=self.dbdata
116 self.poolcats=[
'tbcond',
'oflcond']
118 raise RuntimeError(
"Unknown globalflags.DetGeo: %s" % globalflags.DetGeo())
119 if (self.dbname!=
''):
120 self.msg.
info(
'Setting up conditions DB access to instance %s', self.dbname)
122 self._SetAcc(
'INDET',
'COOLONL_INDET')
123 self._SetAcc(
'INDET_ONL',
'COOLONL_INDET')
124 self._SetAcc(
'PIXEL',
'COOLONL_PIXEL')
125 self._SetAcc(
'PIXEL_ONL',
'COOLONL_PIXEL')
126 self._SetAcc(
'SCT',
'COOLONL_SCT')
127 self._SetAcc(
'SCT_ONL',
'COOLONL_SCT')
128 self._SetAcc(
'TRT',
'COOLONL_TRT')
129 self._SetAcc(
'TRT_ONL',
'COOLONL_TRT')
130 self._SetAcc(
'LAR',
'COOLONL_LAR')
131 self._SetAcc(
'LAR_ONL',
'COOLONL_LAR')
132 self._SetAcc(
'TILE',
'COOLONL_TILE')
133 self._SetAcc(
'TILE_ONL',
'COOLONL_TILE')
134 self._SetAcc(
'MUON',
'COOLONL_MUON')
135 self._SetAcc(
'MUON_ONL',
'COOLONL_MUON')
136 self._SetAcc(
'MUONALIGN',
'COOLONL_MUONALIGN')
137 self._SetAcc(
'MUONALIGN_ONL',
'COOLONL_MUONALIGN')
138 self._SetAcc(
'MDT',
'COOLONL_MDT')
139 self._SetAcc(
'MDT_ONL',
'COOLONL_MDT')
140 self._SetAcc(
'RPC',
'COOLONL_RPC')
141 self._SetAcc(
'RPC_ONL',
'COOLONL_RPC')
142 self._SetAcc(
'TGC',
'COOLONL_TGC')
143 self._SetAcc(
'TGC_ONL',
'COOLONL_TGC')
144 self._SetAcc(
'CSC',
'COOLONL_CSC')
145 self._SetAcc(
'CSC_ONL',
'COOLONL_CSC')
146 self._SetAcc(
'TDAQ',
'COOLONL_TDAQ')
147 self._SetAcc(
'TDAQ_ONL',
'COOLONL_TDAQ')
148 self._SetAcc(
'GLOBAL',
'COOLONL_GLOBAL')
149 self._SetAcc(
'GLOBAL_ONL',
'COOLONL_GLOBAL')
150 self._SetAcc(
'TRIGGER',
'COOLONL_TRIGGER')
151 self._SetAcc(
'TRIGGER_ONL',
'COOLONL_TRIGGER')
152 self._SetAcc(
'CALO',
'COOLONL_CALO')
153 self._SetAcc(
'CALO_ONL',
'COOLONL_CALO')
154 self._SetAcc(
'FWD',
'COOLONL_FWD')
155 self._SetAcc(
'FWD_ONL',
'COOLONL_FWD')
159 if (self.isMC
or not self.isOnline):
160 self._SetAcc(
'INDET_OFL',
'COOLOFL_INDET')
161 self._SetAcc(
'PIXEL_OFL',
'COOLOFL_PIXEL')
162 self._SetAcc(
'SCT_OFL',
'COOLOFL_SCT')
163 self._SetAcc(
'TRT_OFL',
'COOLOFL_TRT')
164 self._SetAcc(
'LAR_OFL',
'COOLOFL_LAR')
165 self._SetAcc(
'TILE_OFL',
'COOLOFL_TILE')
166 self._SetAcc(
'MUON_OFL',
'COOLOFL_MUON')
167 self._SetAcc(
'MUONALIGN_OFL',
'COOLOFL_MUONALIGN')
168 self._SetAcc(
'MDT_OFL',
'COOLOFL_MDT')
169 self._SetAcc(
'RPC_OFL',
'COOLOFL_RPC')
170 self._SetAcc(
'TGC_OFL',
'COOLOFL_TGC')
171 self._SetAcc(
'CSC_OFL',
'COOLOFL_CSC')
172 self._SetAcc(
'TDAQ_OFL',
'COOLOFL_TDAQ')
173 self._SetAcc(
'DCS_OFL',
'COOLOFL_DCS')
174 self._SetAcc(
'GLOBAL_OFL',
'COOLOFL_GLOBAL')
175 self._SetAcc(
'TRIGGER_OFL',
'COOLOFL_TRIGGER')
176 self._SetAcc(
'CALO_OFL',
'COOLOFL_CALO')
177 self._SetAcc(
'FWD_OFL',
'COOLOFL_FWD')
179 self.msg.
info(
'Running in online mode - no access to COOLOFL schemas')
180 self.iovdbsvc.OnlineMode=
True
183 localfile=
"sqlite://;schema=mycool.db;dbname="
184 self.dblist[
'LOCAL']=localfile
185 self.iovdbsvc.dbConnection=localfile+self.dbname
188 self.iovdbsvc.DBInstance=self.dbname
193 from DBReplicaSvc.DBReplicaSvcConf
import DBReplicaSvc
194 svcMgr+=
DBReplicaSvc(COOLSQLiteVetoPattern=
"/DBRelease/")
199 if 'FRONTIER_SERVER' in os.environ.keys()
and os.environ[
'FRONTIER_SERVER']!=
"" and not self.isOnline:
200 self.iovdbsvc.CacheAlign=3
203 from PoolSvc.PoolSvcConf
import PoolSvc
204 if not hasattr (svcMgr,
'PoolSvc'):
209 for i
in self.poolcats:
210 svcMgr.PoolSvc.ReadCatalog+=[
"apcfile:poolcond/PoolCat_%s.xml" % i]
211 svcMgr.PoolSvc.ReadCatalog+=[
"apcfile:poolcond/PoolFileCatalog.xml"]
213 raise RuntimeError(
'Not enough configuration information to setup ConditionsDB access (are GlobalFlags being used?)')
214 self.msg.
debug(
"Loading basic services for CondDBSetup... [DONE]")
◆ _GetName()
def python.CondDB.CondDB._GetName |
( |
|
self, |
|
|
|
forceMC, |
|
|
|
forceData |
|
) |
| |
|
private |
Definition at line 412 of file CondDB.py.
412 def _GetName(self,forceMC,forceData):
413 "Internal get db instance name, taking into account forceData/MC flags"
◆ _InstanceFromProjectName()
def python.CondDB.CondDB._InstanceFromProjectName |
( |
|
self, |
|
|
|
projectName |
|
) |
| |
|
private |
Definition at line 422 of file CondDB.py.
422 def _InstanceFromProjectName(self,projectName):
424 year=
int(projectName[4:6])
426 self.msg.warning(f
"Failed to extract year from project tag '{projectName}', using CONDBR2.")
◆ _SetAcc()
def python.CondDB.CondDB._SetAcc |
( |
|
self, |
|
|
|
ident, |
|
|
|
schema |
|
) |
| |
|
private |
Definition at line 408 of file CondDB.py.
408 def _SetAcc(self,ident,schema):
409 "Internal helper function to setup database access string"
410 self.dblist[ident]=
"%s/" % schema
◆ addFolder()
def python.CondDB.CondDB.addFolder |
( |
|
self, |
|
|
|
ident, |
|
|
|
folder, |
|
|
|
force = False , |
|
|
|
forceMC = False , |
|
|
|
forceData = False , |
|
|
|
className = None , |
|
|
|
extensible = False |
|
) |
| |
Add access to the given folder, in the identified subdetector schema.
If EXTENSIBLE is set, then if we access an open-ended IOV at the end of the list,
the end time for this range will be set to just past the current event.
Subsequent accesses will update this end time for subsequent events.
This allows the possibility of later adding a new IOV using IOVSvc::setRange.
Definition at line 216 of file CondDB.py.
216 def addFolder(self,ident,folder,force=False,forceMC=False,forceData=False,
217 className=None,extensible=False):
218 """Add access to the given folder, in the identified subdetector schema.
219 If EXTENSIBLE is set, then if we access an open-ended IOV at the end of the list,
220 the end time for this range will be set to just past the current event.
221 Subsequent accesses will update this end time for subsequent events.
222 This allows the possibility of later adding a new IOV using IOVSvc::setRange."""
224 for block
in self.blocklist:
225 if (folder.find(block)>=0
and not force):
return
228 if (ident
in self.dblist.
keys()):
229 folderadd=
"<db>%s%s</db> %s" % (self.dblist[ident],self._GetName(forceMC,forceData),folder)
232 elif (ident.find(
'.')>0):
234 folderadd=
'<db>sqlite://;schema=%s;dbname=%s</db> %s' % (ident,self._GetName(forceMC,forceData),folder)
236 raise RuntimeError(
"Conditions database identifier %s is not defined" % ident)
238 folderadd = folderadd +
'<extensible/>'
240 self.iovdbsvc.Folders+=[folderadd]
243 key = (className, self.extractFolder(folder))
244 if key
not in condInputLoader.Load:
245 condInputLoader.Load.add(key)
◆ addFolderSplitMC()
def python.CondDB.CondDB.addFolderSplitMC |
( |
|
self, |
|
|
|
ident, |
|
|
|
folder1, |
|
|
|
folder2, |
|
|
|
force = False , |
|
|
|
forceMC = False , |
|
|
|
forceData = False , |
|
|
|
className = None |
|
) |
| |
Definition at line 263 of file CondDB.py.
263 def addFolderSplitMC(self,ident,folder1,folder2,force=False,forceMC=False,forceData=False,className=None):
264 "Add access to given folder, using folder1 (online) for real data, folde2 (offline) for MC"
266 self.addFolder(ident+
'_OFL',folder2,force=force,forceMC=forceMC,forceData=forceData,className=className)
268 self.addFolder(ident,folder1,force=force,forceMC=forceMC,forceData=forceData,className=className)
◆ addFolderSplitOnline()
def python.CondDB.CondDB.addFolderSplitOnline |
( |
|
self, |
|
|
|
ident, |
|
|
|
folder1, |
|
|
|
folder2, |
|
|
|
force = False , |
|
|
|
forceMC = False , |
|
|
|
forceData = False , |
|
|
|
className = None , |
|
|
|
extensible = False |
|
) |
| |
Definition at line 251 of file CondDB.py.
251 def addFolderSplitOnline(self,ident,folder1,folder2,force=False,forceMC=False,forceData=False,
252 className=None,extensible=False):
253 "Add access to given folder, using folder1 online, folder2 offline"
254 if self.isOnline
and not self.isMC:
255 self.addFolder(ident,folder1,force=force,forceMC=forceMC,forceData=forceData,
256 className=className,extensible=extensible)
259 self.addFolder(ident+
'_OFL',folder2,force=force,forceMC=forceMC,forceData=forceData,
260 className=className,extensible=extensible)
◆ addFolderWithTag()
def python.CondDB.CondDB.addFolderWithTag |
( |
|
self, |
|
|
|
ident, |
|
|
|
folder, |
|
|
|
tag, |
|
|
|
force = False , |
|
|
|
forceMC = False , |
|
|
|
forceData = False , |
|
|
|
className = None |
|
) |
| |
Definition at line 247 of file CondDB.py.
247 def addFolderWithTag(self,ident,folder,tag,force=False,forceMC=False,forceData=False,className=None):
248 "Add access to the given folder/schema, using a specified tag"
249 self.addFolder(ident,folder+
" <tag>%s</tag>" % tag,force,forceMC,forceData,className=className)
◆ addMarkup()
def python.CondDB.CondDB.addMarkup |
( |
|
self, |
|
|
|
folder, |
|
|
|
markup |
|
) |
| |
Definition at line 297 of file CondDB.py.
297 def addMarkup(self,folder,markup):
298 "Add given XML markup to folder string for given folder"
300 for i
in range(0,len(self.iovdbsvc.Folders)):
301 if (self.iovdbsvc.Folders[i].
find(folder)>=0):
302 self.iovdbsvc.Folders[i]+=markup
305 raise RuntimeError(
"conddb.addMarkup: Folder %s is not known to IOVDbSvc" % folder)
◆ addOverride()
def python.CondDB.CondDB.addOverride |
( |
|
self, |
|
|
|
folder, |
|
|
|
tag |
|
) |
| |
Definition at line 270 of file CondDB.py.
271 "Add a tag override for the specified folder"
272 overrideDirective =
'<prefix>%s</prefix> <tag>%s</tag>' % (folder,tag)
273 if overrideDirective
not in self.iovdbsvc.overrideTags:
274 self.iovdbsvc.overrideTags+=[overrideDirective]
◆ blockFolder()
def python.CondDB.CondDB.blockFolder |
( |
|
self, |
|
|
|
folder |
|
) |
| |
Definition at line 276 of file CondDB.py.
277 "Block use of specified conditions DB folder so data can be read from elsewhere"
278 self.blocklist+=[folder]
280 for i
in range(0,len(self.iovdbsvc.Folders)):
281 if (self.iovdbsvc.Folders[i].
find(folder)>=0):
282 del self.iovdbsvc.Folders[i]
285 folderName = self.extractFolder(folder)
286 for f
in condInputLoader.Load:
287 if (f[-1] == folderName):
288 condInputLoader.Load.remove(f)
◆ dumpFolderReadReal()
def python.CondDB.CondDB.dumpFolderReadReal |
( |
|
self, |
|
|
|
outfile |
|
) |
| |
Definition at line 397 of file CondDB.py.
397 def dumpFolderReadReal(self,outfile):
398 "Dump configuration information for use in ReadReal in AthenaDBTestRec"
399 ofile=
open(outfile,
'w')
400 ofile.write(
'FolderList=%s\n' % self.iovdbsvc.Folders.__repr__())
◆ dumpFolderTags()
def python.CondDB.CondDB.dumpFolderTags |
( |
|
self, |
|
|
|
outfile, |
|
|
|
folderNames = False , |
|
|
|
folderOrigin = False |
|
) |
| |
Definition at line 353 of file CondDB.py.
353 def dumpFolderTags(self,outfile,folderNames=False,folderOrigin=False):
354 "Write out folder-specific tag names to file, for use with AtlCoolCopy tools"
355 ofile=
open(outfile,
'w')
356 for folderstr
in self.iovdbsvc.Folders:
360 fname=self.extractFolder(folderstr)
365 if '<db>' in folderstr:
366 idx1=folderstr.find(
'<db>')+4
367 idx2=folderstr.find(
'</db>')
369 dbname=folderstr[idx1:idx2].strip()
372 elif 'OFL' in dbname:
374 ofile.write(
'--folder %s%s\n' % (fname,dbtype))
375 if '<tag>' in folderstr:
376 idx1=folderstr.find(
'<tag>')+5
377 idx2=folderstr.find(
'</tag>')
379 tag=folderstr[idx1:idx2].strip()
382 if ((tag.find(
'TagInfo')!=0
and tag!=
'HEAD')
or folderOrigin):
383 ofile.write(
'--tag %s\n' % tag)
385 for folderstr
in self.iovdbsvc.overrideTags:
387 if '<tag>' in folderstr:
388 idx1=folderstr.find(
'<tag>')+5
389 idx2=folderstr.find(
'</tag>')
391 tag=folderstr[idx1:idx2].strip()
393 if (tag.find(
'TagInfo')!=0
and tag!=
'HEAD'):
394 ofile.write(
'--tag %s\n' % tag)
◆ extractFolder()
def python.CondDB.CondDB.extractFolder |
( |
|
self, |
|
|
|
folderstr |
|
) |
| |
Definition at line 326 of file CondDB.py.
326 def extractFolder(self,folderstr):
327 "Extract the folder name (non-XML text) from a IOVDbSvc.Folders entry"
331 while ix<len(folderstr):
332 if (folderstr[ix]==
'<' and xmltag==
""):
333 ix2=folderstr.find(
'>',ix)
335 xmltag=(folderstr[ix+1:ix2]).strip()
337 if xmltag[-1] ==
'/':
340 elif (folderstr[ix:ix+2]==
'</' and xmltag!=
""):
341 ix2=folderstr.find(
'>',ix)
346 ix2=folderstr.find(
'<',ix)
347 if ix2==-1: ix2=len(folderstr)
348 if (xmltag==
""): fname=fname+folderstr[ix:ix2]
◆ folderRequested()
def python.CondDB.CondDB.folderRequested |
( |
|
self, |
|
|
|
folder |
|
) |
| |
Definition at line 291 of file CondDB.py.
291 def folderRequested(self,folder):
292 "Return true if the given folder has already been requested"
293 for i
in self.iovdbsvc.Folders:
294 if (i.find(folder)>=0):
return True
◆ GetInstance()
def python.CondDB.CondDB.GetInstance |
( |
|
self, |
|
|
|
forceMC = False , |
|
|
|
forceData = False |
|
) |
| |
Definition at line 403 of file CondDB.py.
403 def GetInstance(self,forceMC=False,forceData=False):
404 "Get the name of the DB instance in use (e.g. OFLP200)"
405 return self._GetName(forceMC,forceData)
◆ setCrestToFile()
def python.CondDB.CondDB.setCrestToFile |
( |
|
self, |
|
|
|
crestData = False |
|
) |
| |
Definition at line 321 of file CondDB.py.
321 def setCrestToFile(self, crestData=False):
322 "Set option to write CREST data to file"
323 self.iovdbsvc.CrestToFile=crestData
◆ setGlobalTag()
def python.CondDB.CondDB.setGlobalTag |
( |
|
self, |
|
|
|
tag |
|
) |
| |
Definition at line 308 of file CondDB.py.
308 def setGlobalTag(self,tag):
309 "Set the GlobalTag value used as the key for hierarhical conditions"
310 self.iovdbsvc.GlobalTag=tag
◆ setRequireLock()
def python.CondDB.CondDB.setRequireLock |
( |
|
self, |
|
|
|
lock = True |
|
) |
| |
Definition at line 313 of file CondDB.py.
313 def setRequireLock(self,lock=True):
314 "Set the flag indicating global tags will be required to be locked"
315 self.iovdbsvc.CheckLock=lock
◆ setWriteDataToFile()
def python.CondDB.CondDB.setWriteDataToFile |
( |
|
self, |
|
|
|
writeData = False |
|
) |
| |
Definition at line 317 of file CondDB.py.
317 def setWriteDataToFile(self, writeData=False):
318 "Set option to write data to file"
319 self.iovdbsvc.OutputToFile=writeData
◆ blocklist
python.CondDB.CondDB.blocklist |
◆ dbdata
python.CondDB.CondDB.dbdata |
◆ dblist
python.CondDB.CondDB.dblist |
◆ dbmc
python.CondDB.CondDB.dbmc |
◆ dbname
python.CondDB.CondDB.dbname |
◆ iovdbsvc
python.CondDB.CondDB.iovdbsvc |
◆ isMC
python.CondDB.CondDB.isMC |
◆ isOnline
python.CondDB.CondDB.isOnline |
◆ msg
◆ poolcats
python.CondDB.CondDB.poolcats |
The documentation for this class was generated from the following file: