CMS 3D CMS Logo

Functions | Variables

python::CommonUtils Namespace Reference

Functions

def commentTableName
def dropAllTreeTables
def inventoryIDTableName
def inventoryTableName
def tagInTrees
def treeIDTableName
def treeTableName

Variables

tuple hello = tagInTrees(session,'Tracker_Geometry_CRUZ3')
tuple intrees = tagInTrees(session,'Tracker_Geometry_CRUZET3')
tuple kitty = tagInTrees(session,'Tracker_Geometry_CRUZET3','pfnme')
tuple mikey = tagInTrees(session,'Tracker_Geometry_CRUZET3','frontier://(proxyurl=https://localhost:3128)(serverurl=https://frontier1.cms:8000/FrontierOnProd)(serverurl=https://frontier2.cms:8000/FrontierOnProd)(retrieve-ziplevel=0)/CMS_COND_20X_ALIGNMENT')
tuple session
tuple svc = coral.ConnectionService()

Function Documentation

def python::CommonUtils::commentTableName ( )

Definition at line 10 of file CommonUtils.py.

00011                       :
00012         return 'ENTRYCOMMENT_TABLE'

def python::CommonUtils::dropAllTreeTables (   dbsession)
drop all tagtree related tables

Definition at line 14 of file CommonUtils.py.

00015                                 :
00016     """drop all tagtree related tables
00017     """
00018     try:
00019         dbsession.transaction().start(False)
00020         tablelist = dbsession.nominalSchema().listTables()
00021         for tname in tablelist:
00022            if tname.find('TAGTREE_') != -1:
00023               dbsession.nominalSchema().dropTable(tname)
00024         dbsession.transaction().commit()
00025     except Exception, e:
00026         raise Exception, str(e)
            
def python::CommonUtils::inventoryIDTableName ( )

Definition at line 4 of file CommonUtils.py.

00005                           :
        return 'TAGINVENTORY_IDS'
def python::CommonUtils::inventoryTableName ( )

Definition at line 2 of file CommonUtils.py.

00003                         :
        return 'TAGINVENTORY_TABLE'
def python::CommonUtils::tagInTrees (   dbsession,
  tagname,
  pfn = '' 
)
returns the tree names which contain the given tag
   select tagid from taginventory_table where tagname=tagname
   select count(*) from tablename where tablename.tagid=tagid

Definition at line 27 of file CommonUtils.py.

00028                                         :
00029     """returns the tree names which contain the given tag
00030        select tagid from taginventory_table where tagname=tagname
00031        select count(*) from tablename where tablename.tagid=tagid
00032     """
00033     try:
00034         dbsession.transaction().start(True)    
00035         invquery = dbsession.nominalSchema().tableHandle(inventoryTableName()).newQuery()
00036         conditionbindDict=coral.AttributeList()
00037         conditionbindDict.extend('tagname','string')
00038         conditionbindDict['tagname'].setData(tagname)
00039         condition='tagname = :tagname'
00040         if len(pfn) !=0 :
00041            condition+=' AND pfn = :pfn'
00042            conditionbindDict.extend('pfn','string')
00043            conditionbindDict['pfn'].setData(pfn)
00044         invquery.setCondition(condition,conditionbindDict)
00045         invquery.addToOutputList('tagid')
00046         invquery.addToOutputList('pfn')
00047         cursor = invquery.execute()
00048         tagidmap={}
00049         while ( cursor.next() ):
00050             tagid=cursor.currentRow()['tagid'].data()
00051             pfn=cursor.currentRow()['pfn'].data()
00052             tagidmap[pfn]=tagid
00053         cursor.close()
00054         dbsession.transaction().commit()
00055         del invquery
00056         if len(tagidmap)==0:
00057            return tagidmap
00058    
00059         result={}
00060         treetablelist=[]
00061         dbsession.transaction().start(True)    
00062         tablelist = dbsession.nominalSchema().listTables()
00063         for t in tablelist:
00064            if t.find('TAGTREE_TABLE_')!= -1:
00065                    treetablelist.append(t)
00066         for (pfn,tagid) in tagidmap.items():
00067            result[pfn]=[]
00068            condition='tagid = :tagid'
00069            for t in treetablelist:
00070               conditionBind=coral.AttributeList()
00071               conditionBind.extend('tagid','unsigned long')
00072               conditionBind['tagid'].setData(tagid)
00073               q=dbsession.nominalSchema().tableHandle(t).newQuery()
00074               q.addToOutputList('count(*)','count')
00075               myresult=coral.AttributeList() 
00076               myresult.extend('count','unsigned long')
00077               q.defineOutput(myresult)
00078               q.setCondition(condition,conditionBind)
00079               cr=q.execute()
00080               while (cr.next()):
00081                 if cr.currentRow()['count'].data()!=0:
00082                   result[pfn].append(t[len('TAGTREE_TABLE_'):])
00083               cr.close()
00084               del q
00085         dbsession.transaction().commit()        
00086         return result    
00087     except Exception, e:
00088         raise Exception, str(e)

def python::CommonUtils::treeIDTableName (   treename)

Definition at line 8 of file CommonUtils.py.

00009                              :
        return 'TAGTREE_'+str.upper(treename)+'_IDS'
def python::CommonUtils::treeTableName (   treename)

Definition at line 6 of file CommonUtils.py.

00007                            :
        return 'TAGTREE_TABLE_'+str.upper(treename)

Variable Documentation

tuple python::CommonUtils::hello = tagInTrees(session,'Tracker_Geometry_CRUZ3')

Definition at line 100 of file CommonUtils.py.

tuple python::CommonUtils::intrees = tagInTrees(session,'Tracker_Geometry_CRUZET3')

Definition at line 97 of file CommonUtils.py.

tuple python::CommonUtils::kitty = tagInTrees(session,'Tracker_Geometry_CRUZET3','pfnme')

Definition at line 103 of file CommonUtils.py.

tuple python::CommonUtils::mikey = tagInTrees(session,'Tracker_Geometry_CRUZET3','frontier://(proxyurl=https://localhost:3128)(serverurl=https://frontier1.cms:8000/FrontierOnProd)(serverurl=https://frontier2.cms:8000/FrontierOnProd)(retrieve-ziplevel=0)/CMS_COND_20X_ALIGNMENT')

Definition at line 106 of file CommonUtils.py.

Initial value:
00001 svc.connect( 'sqlite_file:testInventory.db',
00002                            accessMode = coral.access_Update )

Definition at line 93 of file CommonUtils.py.

Referenced by LumiProducer::beginRun(), ora::SchemaUtils::cleanUp(), ora::ConnectionPool::connect(), TestBase::connect(), RPCDBCom::connect(), popcon::L1RPCHwConfigSourceHandler::ConnectOnlineDB(), popcon::RPCEMapSourceHandler::ConnectOnlineDB(), RPCFw::createFEB(), RPCFw::createGAS(), RPCFw::createIDMAP(), RPCFw::createIMON(), RPCFw::createMix(), cond::CredentialStore::createSchema(), RPCFw::createSTATUS(), RPCFw::createT(), RPCFw::createUXC(), RPCFw::createVMON(), lumi::service::DBService::disconnect(), popcon::RPCEMapSourceHandler::DisconnectOnlineDB(), popcon::L1RPCHwConfigSourceHandler::DisconnectOnlineDB(), cond::CredentialStore::drop(), L1TriggerScalerRead::dropTable(), cond::CredentialStore::exportAll(), DIPLumiProducer::filldetailcache(), LumiProducer::fillLSCache(), DIPLumiProducer::fillsummarycache(), CondDBESSource::fillTagCollectionFromDB(), HcalO2OManager::getListOfPoolIovs(), HcalO2OManager::getListOfPoolTags(), cond::RDBMS::globalTag(), cond::CredentialStore::importForPrincipal(), cond::CredentialStore::installAdmin(), cond::CredentialStore::listConnections(), cond::CredentialStore::listPrincipals(), cond::Utilities::openDbSession(), l1t::DataWriter::payloadToken(), L1RCTOmdsFedVectorProducer::produce(), RunSummaryRead::readData(), RunInfoRead::readData(), L1TriggerScalerRead::readData(), DQMSummaryReader::readData(), popcon::RPCEMapSourceHandler::readEMap1(), popcon::L1RPCHwConfigSourceHandler::readHwConfig1(), l1t::DataWriter::readObject(), cond::CredentialStore::removeConnection(), cond::CredentialStore::removePrincipal(), lumi::TRGDummy2DB::retrieveData(), lumi::LumiDummy2DB::retrieveData(), lumi::CMSRunSummaryDummy2DB::retrieveData(), lumi::Lumi2DB::retrieveData(), lumi::HLTDummy2DB::retrieveData(), lumi::HLTConfDummy2DB::retrieveData(), l1t::WriterProxyT< Record, Type >::save(), cond::CredentialStore::selectForUser(), cond::CredentialStore::selectPermissions(), cond::CredentialStore::setPermission(), cond::CredentialStore::unsetPermission(), cond::CredentialStore::updateConnection(), cond::CredentialStore::updatePrincipal(), and l1t::DataWriter::writeKeyList().

tuple python::CommonUtils::svc = coral.ConnectionService()