Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:50:34

0001 #
0002 # I should write a decent test of the python binding...
0003 #
0004 import sys, DLFCN
0005 sys.setdlopenflags(DLFCN.RTLD_GLOBAL+DLFCN.RTLD_LAZY)
0006 
0007 from pluginCondDBPyInterface import *
0008 a = FWIncantation()
0009 os.putenv("CORAL_AUTH_PATH","/afs/cern.ch/cms/DB/conddb")
0010 rdbms = RDBMS()
0011 
0012 logName = "sqlite_file:log.db"
0013 dbName = "sqlite_file:pop_test.db"
0014 
0015 dbName =  "oracle://cms_orcoff_prod/CMS_COND_20X_ECAL"
0016 logName = "oracle://cms_orcoff_prod/CMS_COND_21X_POPCONLOG"
0017 
0018 rdbms.setLogger(logName)
0019 from CondCore.Utilities import iovInspector as inspect
0020 
0021 db = rdbms.getDB(dbName)
0022 tags = db.allTags()
0023 
0024 vi = VInt()
0025 vf = VFloat()
0026 
0027 for tag in tags.split() :
0028     try :
0029         log = db.lastLogEntry(tag)
0030         print log.getState()
0031         iov = inspect.Iov(db,tag)
0032         print iov.list()
0033 #        print iov.summaries()
0034 #        print iov.trend("",[0,2,12])
0035     except RuntimeError :
0036         print " no iov? in", tag
0037 
0038 
0039 iov=0
0040 
0041 tag='EcalPedestals_online'
0042 what = inspect.extractorWhat(db,tag)
0043 ans = {}
0044 for key in what.keys():
0045     (mode,val) = what[key]
0046     if (mode=='single') :
0047         ans[key]=val[2]
0048     else :
0049         ans[key]=[0,2,12]
0050 
0051 
0052 iov = inspect.Iov(db,tag)
0053 print iov.trend(ans)
0054 ans = {'how': 'all', 'quantity': 'mean_x3', 'which' : []}
0055 print iov.trend(an)
0056 ans = {'how': 'singleChannel', 'quantity': 'mean_x6', 'which' : [0,200,1200]}
0057 print iov.trend(ans)
0058 
0059 
0060 
0061 
0062 # tag = tags.split()[0]
0063 
0064 token = log.payloadToken
0065 
0066 p = inspect.PayLoad(db,token)
0067 print p
0068 
0069 p=0
0070 
0071 p = db.payLoad(token)
0072 o = Plug.Object(p)
0073 o.summary()
0074 o.dump()
0075 o=0
0076 
0077 tag = tags.split()[0]
0078 iov = inspect.Iov(db,tag)
0079 iov.summaries()
0080 iov.trend("",[0,2,12])
0081 
0082 
0083 
0084 o = iovInspector.PayLoad(db,log.payloadToken)
0085 
0086         exec('import '+db.moduleName(tag)+' as Plug')   
0087         iov = db.iov(tag)
0088         log = db.lastLogEntry(tag)
0089         print tag, iov.size(), log.execmessage, log.exectime, log.payloadIdx 
0090         vi = VInt()
0091         vi.append(0)
0092         vi.append(2)
0093         vi.append(12)
0094         ex = Plug.Extractor("",vi)
0095         for elem in iov.elements :
0096             p = Plug.Object(elem)
0097             print elem.since(), elem.till(),p.summary()
0098             p.extract(ex)
0099             for v in ex.values() :
0100                 print v
0101 
0102 
0103 token = '[DB=00000000-0000-0000-0000-000000000000][CNT=EcalPedestalsRcd][CLID=75E7B995-8233-097B-FD4A-31AEC6A040C8][TECH=00000B01][OID=0000000C-00000114]'
0104 p = inspect.PayLoad(db,token)