Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #
0002 # I should write a decent test of the python binding...
0003 #
0004 import os,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_test3.db"
0014 
0015 rdbms.setLogger(logName)
0016 from CondCore.Utilities import iovInspector as inspect
0017 
0018 db = rdbms.getDB(dbName)
0019 tags = db.allTags()
0020 
0021 vi = VInt()
0022 vf = VFloat()
0023 
0024 for tag in tags.split() :
0025     try :
0026         log = db.lastLogEntry(tag)
0027         print log.getState()
0028         iov = inspect.Iov(db,tag)
0029         print iov.list()
0030 #        print iov.summaries()
0031 #        print iov.trend("",[0,2,12])
0032     except RuntimeError :
0033         print " no iov? in", tag
0034 
0035 
0036 iov=0
0037 
0038 tag='Example_tag2'
0039 what = inspect.extractorWhat(db,tag)
0040 print what
0041 
0042 ans = {'which':[0,2,12],'quantity':[0]}
0043 iov = inspect.Iov(db,tag)
0044 print iov.trend(ans)
0045 ans = {'which':[0,2,12],'quantity':[1]}
0046 print iov.trend(ans)
0047 ans = {'which':[0,2,12],'quantity':[0,1]}
0048 print iov.trend(ans)
0049 
0050 
0051 
0052 
0053 # tag = tags.split()[0]
0054 
0055 token = log.payloadToken
0056 
0057 p = inspect.PayLoad(db,token)
0058 print p
0059 
0060 p=0
0061 
0062 p = db.payLoad(token)
0063 o = Plug.Object(p)
0064 o.summary()
0065 o.dump()
0066 o=0
0067 
0068 tag = tags.split()[0]
0069 iov = inspect.Iov(db,tag)
0070 iov.summaries()
0071 iov.trend("",[0,2,12])
0072 
0073 
0074 
0075 o = iovInspector.PayLoad(db,log.payloadToken)
0076 
0077         exec('import '+db.moduleName(tag)+' as Plug')   
0078         iov = db.iov(tag)
0079         log = db.lastLogEntry(tag)
0080         print tag, iov.size(), log.execmessage, log.exectime, log.payloadIdx 
0081         vi = VInt()
0082         vi.append(0)
0083         vi.append(2)
0084         vi.append(12)
0085         ex = Plug.Extractor("",vi)
0086         for elem in iov.elements :
0087             p = Plug.Object(elem)
0088             print elem.since(), elem.till(),p.summary()
0089             p.extract(ex)
0090             for v in ex.values() :
0091                 print v
0092 
0093 
0094 token = '[DB=00000000-0000-0000-0000-000000000000][CNT=EcalPedestalsRcd][CLID=75E7B995-8233-097B-FD4A-31AEC6A040C8][TECH=00000B01][OID=0000000C-00000114]'
0095 p = inspect.PayLoad(db,token)