10 tagusefile=
'/afs/cern.ch/user/a/atlcond/notify/AtlCoolMerge.taguse'
13 options, remainder = getopt.getopt(sys.argv[1:],
'h', [
'help',
'folder=',
'globaltag=',
'instance=',
'localtag=',
'schema=',
'server='])
22 schema =
"COOLOFL_TILE"
24 for opt, arg
in options:
28 elif opt
in (
'--help'):
30 elif opt
in (
'--folder'):
32 elif opt
in (
'--globaltag'):
34 elif opt
in (
'--localtag'):
36 elif opt
in (
'--instance'):
38 elif opt
in (
'--schema'):
40 elif opt
in (
'--server'):
44 print (
' it does not work with singleversion folders')
48 print (
' This script prints aliases for CURRENT and NEXT global tags')
49 print (
' if no options are provided and also resolves global tag ')
50 print (
' to leaf tag if')
51 print (
' folder is provided. By default, if global tag is not specified,')
52 print (
' globaltag=CURRENT')
53 print (
' if local tag is specified, it makes inverse operation - ')
54 print (
' shows all global tags linked to local tag')
56 print (
' default instance=CONDBR2')
58 print (
' CheckTagAssociation.py --folder=foldername --globaltag=tagname --instance=instancename --localtag=leaftagname')
59 print (
"options globaltag and localtag are mutually exclusive")
60 print (
" if both are specified, globaltag is ignored and ")
61 print (
" association of localtag to all global tags is printed")
63 print (
"CheckTagAssociation.py --folder=/TILE/OFL02/CALIB/CES --localtag=TileOfl02CalibCes-RUN2-HLT-UPD1-01")
64 print (
"CheckTagAssociation.py --folder=/TILE/OFL02/CALIB/CES")
68 from TileCalibBlobPython
import TileCalibTools
69 current = TileCalibTools.getAliasFromFile(
'Current')
70 nexttag = TileCalibTools.getAliasFromFile(
'Next')
72 from TileCalibBlobPython.TileCalibLogger
import getLogger
75 log.setLevel(logging.WARNING)
79 print (
"alias CURRENT = %s alias NEXT = %s" % (current, nexttag))
85 connStr=schema+
'/'+instance
88 db = TileCalibTools.openDbConn(connStr, server)
93 foldertag = TileCalibTools.getFolderTag(db, folder, globaltag)
94 print (
"global tag %s associated to leaf TAG %s" % (globaltag,foldertag))
96 foldertag = TileCalibTools.getFolderTag(db, folder, current)
97 print (
"global tag %s associated to leaf TAG %s" % (current,foldertag))
98 foldertag = TileCalibTools.getFolderTag(db, folder, nexttag)
99 print (
"global tag %s associated to leaf TAG %s" % (nexttag,foldertag))
102 rfolder=db.getFolderSet(
'/')
103 taglist=rfolder.listTags()
108 foldertag = TileCalibTools.getFolderTag(db, folder,
str(tag))
109 if localtag == foldertag:
110 print (
" leaf tag %s linked to global tag %s " % (localtag, tag))
115 print (
" leaf tag %s is not linked to any global tag" % localtag)